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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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
Community showcase
Published in Statuspage

New feature: Slack notifications for Statuspage

We're excited to announce the release of a long-requested feature on Statuspage. Now visitors to your status page can subscribe to get notified in Slack when you report an incident or maintenance. Th...

51 views 0 8
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you