Insert table in Description (system field) using JIRA ScriptRunner Behaviour

Kamal Iqlaas Ismail September 23, 2021

Good day everyone, hope this post finds you safe and sound.

As per subject, the objective is to pre-load the table inside the Description (JIRA System Field)

Not sure if this is achievable using GUI (if yes, great), hence the question on ScriptRunner Behaviour.

We followed this, but could not make it work. We also saw, the table var is defined two times, we followed it blindly, but the Script Editor is showing error.

When we defined it once, no error is showing, but the table is not loading on the Visual tab as desired, but when we switched it to Text tab, the text for the table is the same as when we insert the tab manually.

Here is the desired table that we want to pre-load when a user is creating an issue

Screenshot 2021-09-24 at 10.47.01 AM.png

Here is the Text tab.Screenshot 2021-09-24 at 10.47.18 AM.png

We got confused when this post stated need to use Markdown, we tried that as well, but did not achieve it either.

This is the code in our behaviour.

import groovy.transform.BaseScript
import com.onresolve.jira.groovy.user.FieldBehaviours

@BaseScript FieldBehaviours fieldBehaviours

def desc = getFieldById("description")

def table = """Please enter your details in the below table -
||Heading 1|||Heading 2|||Heading 3|||Heading 4|||Heading 5|||Heading 6||
| | | | | | |
"""

desc.setFormValue(table)

Any pointers will be helpful!

Version for JIRA Project Management Software: 8.13.8

2 answers

1 accepted

1 vote
Answer accepted
Kamal Iqlaas Ismail September 24, 2021

By using HTML, we got what we need.

Hopefully this helps others who faced similar issue!

Caroline Hall
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 8, 2023

@Kamal Iqlaas Ismail can you share what your HTML looked like?

Kamal Iqlaas Ismail May 8, 2023

Hey @Caroline Hall , appreciate your response. Actually, we use MD again, as when we were developing, it was in staging environment, But when we deployed to production, everything work wonders!

 

Here is our code (screenshot)

Screenshot 2023-05-09 at 10.05.31 AM.png

Do note that there indentation for row is not needed.

kiranmai_genkolla October 19, 2023

How can i get this format in the custom field as well

Kamal Iqlaas Ismail October 23, 2023

hey @kiranmai_genkolla , the custom field type must be a text field i think. hope this helps!

0 votes
Suvarna Gaikwad
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 23, 2021

@Kamal Iqlaas Ismail script looks fine except for table variable definition where there are additional | characters in between header.

Please try below.

def table = " " " Please enter your details in the below table - 

|| Heading 1|| Heading 2 || Heading 3 || Heading 4 || Heading 5 || Heading 6 ||

| | | | | | |

" " "

Kamal Iqlaas Ismail September 24, 2021

Apparently, we need to use HTML.

Appreciate your response though!

Anjana Krishnan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 16, 2021

Could you please help with that code snippet?

Kamal Iqlaas Ismail May 8, 2023

Hi @Anjana Krishnan , please refer my answer to Caroline above. Thanks!

Like kiranmai_genkolla likes this

Suggest an answer

Log in or Sign up to answer