Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,557,802
Community Members
 
Community Events
184
Community Groups

Setting field help text using scriptrunner behaviour

I want to add description help text for the reporter field via behaviours in script runner to include html links as this can't be applied in the normal format of editing descriptions in JIRA admin set-up.

Please can you provide a dummy example that I can apply for a) Reporter (help text to a web link) and also b) to a custom field that is a user picker format.

2 answers

2 votes
Marcos Sanchez
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.
May 18, 2018

Hi,

 

With a behaviour, adding the field(s) that you want to affect, you can use this script to add a help text for it.

getFieldById("reporter").setHelpText("HELP TEXT <a href=\"www.google.com\">HELP</a>")

 

Replacing "reporter" by the id of the field you can define which field to use and you can use multiple fields by adding them.

Official Docu here.

 

As an example, I did it with the Reporter field:

2018-05-18_12h52_23.png2018-05-18_12h52_44.png

 

Hope it helps.

 

Regards.
Marcos

Thanks for the example. I'm trying to add default text to a Root Cause field.  I tried two different ways, but when I save it and open a jira it still doesn't show up.  I checked that my behaviors modules were enabled.   Anyone know what might be wrong?

Playing with behaviors plugin:

1.  I set the mappings to only Incident and Problem.

Mappings

 Incident Management System (Incident)

  Incident Management System (Problem) 

 

2.  I tried this in the behaviour settings Initialiser section but nothing showed up on the jira form:

def rootcause = getFieldById("Root Cause")

def rootcauseValue = """

        h2. Root Cause:

        h2. Workaround (solution) Actions:

        h2. Preventative/Corrective Actions:"""

if ( ! rootcause.getValue()) {

    rootcause.setFormValue(rootcauseValue)}

 

3.  I also tried this in the behaviour settings initialiser section, but still didn't work:

getFieldById("Root Cause").setHelpText("Root Cause: \nWorkaround solution Actions: \n Preventative/Corrective Actions:")

 

Anyone know what I'm doing wrong here?

Hi @Alicia Pena 

In your second example it will work if you change the name Root cause in row 1 to ("customfield_xxxxx")

Where xxxxx is the field Id. Now you ask getFieldById not the get Field ByName.

Hope that helps!

/Daniel

I found this example that sort of worked.  Formatting is still a problem, but it does show:

 

 

def desc = getFieldById("description")

def defaultValue = """
Problem Statement: An outline of the problem we're trying to solve or task to accomplish

Solution/How: How we plan to fix or solve the issue

Definition of Done: What constitutes this task being marked as completed

Stakeholders: Who are the stakeholders? DevOps/Engineering etc? Do we need buy-in or feedback to close the task? Should get confirmation of the task being completed up to stakeholders standards before moving to done status

Notes: Additional notes so others can read the ticket and grasp extra prerequisite information
""".replaceAll(/ /, '')

if (! underlyingIssue?.description) {
desc.setFormValue(defaultValue)
}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events