MISC Custom Fields: Calculated text field based on issuetype

I am trying to populate a text field based on issue type:

<!-- @@Formula:
String s = issue.get("issuetype").getName();
if (s == "Other") return "This is of issue type other";
-->

s is getting populated with "Other", however, when I compare it in if statement I do not see the output. 

Thanks!!

5 answers

1 accepted

This widget could not be displayed.
Peter Bengov Community Champion Apr 16, 2015

You can cast the value, that should work

if (s.equals("Change Relationship")) 
	return (int)issue.get("customfield_11501");
This widget could not be displayed.
Peter Bengov Community Champion Apr 09, 2015

Try 

s.equals("Other")
This widget could not be displayed.

Awesome! Thanks Peter smile

Peter Bengov Community Champion Apr 10, 2015

You are welcome

This widget could not be displayed.

Hi Peter,

I am trying to calculate a number field but I do not want to display the decimal point. Is there a way to convert a field value to whole number?

This is giving no result. customfield_11501 value is 51 and it displays 51.0 when I display it as it is.

if (s.equals("Change Relationship"))
{
value=issue.get("customfield_11501");
return numberTool.format(value);
}

 

Thanks!!

This widget could not be displayed.

Yup, that worked and it's Java implementation. Things makes so much more sense now laugh

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

162 views 1 3
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you