Auto-populate Description field for specific project in JIRA with a table

I've auto-populated description field with text before. I need help with auto-populating it with a table with columns. Can you give directions on how to achieve this? I tried some javascript code but it doesn't display anything on Create screen.

2 answers

1 accepted

0 votes
Accepted answer

If you have ScriptRunner, then have a look at how to achieve it through Behaviours:

So I should be writing a Groovy script for creating table with columns right?

You may create a table with wiki notation:

||column 1||column 2||column 3||

|cell value 1|cell value 2|cell value 3|

If you would like to get a more sophisticated table, you may want to have a look at the Table Grid Editor plugin, which lets you create a table as a custom field.

My reply didn't get posted when I tried to hit reply after typing the message here, so I replied under Suggest an Answer field

I've already tried this before I raised a question here. I've enabled wiki style renderer to the description field which shows a table when I put in the above wiki notation (it actually looks more like separated rows with columns rather a table). But what I need is to auto-populate a table with column headers in the description field on the create screen. Earlier, I've auto-populated text in description field by putting javascript under the below path.
JIRA administration --> Issues --> Fields --> Field Configurations --> Description [Wiki Style Renderer] --> Edit --> Edit Field Description: Description --> place the javascript under Description box here

In the same way, how do I modify this javascript to populate the description field with a table having column type headers such as: Column1 | Column2  | Column3 | Column4  | Column5 | Column6

I went through your first response and tried using a behaviour. I was successfully able to display text in Description field using a behaviour. But, I need to know the function to be used to populate a table in the description field. I have googled and all that I see is to how to CREATE TABLE in a database but I don't need that. All I need is to create a simple table with rows and columns having column headers so that users can input their details into the table.

I've also checked the Table Grid Editor plugin but I need this for the system field (Description) but not for custom fields in my case.

Have you tried the wiki notation of a table in conjunction with a behaviour? That way you may define one or more tables with the appropriate column headers for any project & issue type combinations.

I tried that, pls see the results above

first is expected, second is actual

May you click on the Text tab of the actual result to see its wiki notation?

Try copying this in Text mode:

||column 1||column 2||column 3||
|cell value 1|cell value 2|cell value 3|

I suspect you have one extra carriage return between both lines, which is causing the weird display of the table. Just remove the empty line between the column headers and the first row and the table will be displayed correctly.

Now, I use similar script for a custom field but the text doesn't appear in the field on the create screen. Can you please help?

I would need some info to help you further:

  • Did you follow this step by step guide, adapting it to your custom field?
  • May you paste here your script?
  • Did you map the behaviour to the correct project(s) and/or issue type(s), and performed your tests accordingly?

Yes, I did follow the steps in the link and it worked for description

Below is my script for a new custom field called ServiceRequestDetails

def srd = getFieldById("ServiceRequestDetails")

def defaultValue = """Please enter the values for""".replaceAll(/    /, '')


I mapped the behavior to the correct project and issue type. The ServiceRequestDetails field is seen on the screen but it is empty. This is a multi-line text field.

May you try this alternative line?

def srd = getFieldByName("ServiceRequestDetails")

This doesn't work too

Reviewing the docs for Description:

There's no need to select the fields, as they are implicit in the code.

Perform the following actions, and try again after each of them:

  • remove the selection of both fields
  • (if the previous action do not work) add both codes to the same initialiser function

Yes, I have tried this earlier but with getFieldById instead of getFieldByName. So it didn't work earlier and it works now!

But looks like I have a problem displaying a table in the field. It must be a wiki renderer issue but am not able to fix that. The same script works for Description field and it shows a table but it doesn't display the table for the Service Request Details field. So issue is not with the script but with the field.

I've actually tried to put in a default value by configuring the custom field 'Service Request Details' itself. It worked it displayed table with content but it works intermittently - it doesn't display table and within few mins if I hit create issue button it again does display. The behavior script didn't even show the table once. Basically the Visual and Text tabs are not seen on the Service Request Details field unlike Description. Do you know how to turn that on?

Also I want to know if we can display different contents in the Service Request Details field for one project when a different Request Type is chosen. Request type is a Dynamic Select (using Intenso Dynamic Forms) Custom field.

Regarding my query about Service Request Details field I have turned on the Wiki Renderer but it works on and off. Sometimes it displays a table and sometimes just as plain text.

Then I'd open a help request with ScriptRunner Support:

Should you find out how to fix it, please, post the solution here so that other community members with the same problem can obtain the correct answer here.

Best regards

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,712 views 17 21
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you