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

You can cast the value, that should work

if (s.equals("Change Relationship")) 
	return (int)issue.get("customfield_11501");

Try 

s.equals("Other")

Awesome! Thanks Peter smile

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!!

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

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,826 views 12 18
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot