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,555,235
Community Members
 
Community Events
184
Community Groups

Search issue string for key word, custome field script

Edited

Hi,

I have created a budget status field and returns:

Result type:
String
Result value:
<div style='background-color: green; color: white; padding: 5px; width: 95px; border-radius:4px; text-align: center'><b>Under Budget</b></div>

 

I would like to use the out put from the 'budget field' to create a project status. The out put from the budget field is above a long string. I would like to pick out a word from this string then use this. Do I need to feed the 'Budget Status' into a variable then search this for a word ie Under Budget

Is this possible?

 

Thanks for your help

Kevin

My script so far is now working:

 

import com.atlassian.jira.component.ComponentAccessorissue.statusissue.getAsString("Budget Status")


if (Budget Status == '<div style='background-color: green; color: white; padding: 5px; width: 95px; border-radius:4px; text-align: center'><b>Under Budget</b></div>')

{
    result += "<div style='background-color: green; color: white; padding: 5px; width: 95px; border-radius:4px; text-align: center'><b>On Schedule</b></div>"

}
return Result

1 answer

1 accepted

0 votes
Answer accepted
Ivan Tovbin
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.
Nov 21, 2018 • edited

Hi Kevin,

I don't quite understand what exactly you are trying to achieve here. By the looks of it, your "Budget Status" field is a scripted field with HTML template. You want to get this field's value, cut off all HTML tags and pass the actual value somewhere else (to another field)?

If this is the case, then I suggest matching your "Budget Status" value against a regex and the pass the result to wherever you need.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events