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

1 vote
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");
1 vote
Peter Bengov Community Champion Apr 09, 2015

Try 

s.equals("Other")

Awesome! Thanks Peter smile

Peter Bengov Community Champion Apr 10, 2015

You are welcome

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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

178 views 1 10
Read article

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