Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
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

We want to set helptext for "Description" field via behavior

Our JIRA had installed the "Script Runner" plugin.

1, We want to set helptext for "Description" field by behavior if we , the original code as below:


if(secondCategory.contains("aaaaaaaaaaaaa")){

descValue = "Request Template"
helpText= "<a href='abbbb.html'> Request Template</a>"


}

else if(secondCategory.contains("XXXXXXX")){
//description.clearHelpText()
descValue = " internal Request)"
helpText="<a href='abcd.html'> internal Request Template</a>"
}

}
description.setFormValue(descValue)
description.setHelpText(helpText)

2, According above code, if we select correct options for "Category" field, the helptext will have different value.

But, if the value of "Category"meets the first condition, the helptext works normally.

And, if we change the option(meet another condition) of "Category" field,  the value of the helptext had been set successfully(we see it in our logs), but we can't see it show on screen.

If anyone can give us some solution, thanks in advance.

 

 

 

 

  

 

 

 

 

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Joshua Yamdogo @ Adaptavist
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.
Sep 29, 2017 • edited

Hello Meng Ge,

Your script looks almost correct to me. I wrote this script:

def secondCategory = getFieldByName("Category") // your field name here
def description = getFieldById("description")

if (secondCategory.getValue().toString().contains("AAA")) {
description.setFormValue("Request Template")
description.setHelpText("<a href='abbbb.html'> Request Template</a>")
}
else {
description.setFormValue("Interal Request")
description.setHelpText("<a href='abcd.html'> Internal Request Template</a>")
}   

This behaviour script is attached to the "Category" field, not the "Description" field.

Image of it working:

Screen Shot 2017-09-29 at 4.07.40 PM.png

 

TAGS
AUG Leaders

Atlassian Community Events