cancel
Showing results for
Search instead for
Did you mean:
See all
See all
##### Groups
Explore all groups

# Using IF statement in Misc Custom Fields for Total Number

Hi,

I'm trying to use JIRA Misc Custom Fields and IF statements to determine the following:

If Customfield_10104 = 1

and Customfield_10105 = 1

return 1

If Customfield_10104 = 1

and Customfield_10105 = 5

return 9

Basically i'm trying to replace an existing spreadsheet that uses X/Y calculations (i.e. bespoke non-logical calculations) but can't get the IF statement to work, i could return the value of the customfield, and customfield_10104 + customfield_10105 = total but this is just adding them together but i need it to return a bespoke answer...HELP!

Many thanks

## 1 answer

0 votes

Assuming your custom fields are number fields:

```if (issue.get("customfield_10104")==1 &amp;&amp; issue.get("customfield_10105")==1)
return 1;
else if (issue.get("customfield_10104")==1 &amp;&amp; issue.get("customfield_10105")==5)
return 9;

return 0; //or any other default value```

If your custom fields are text fields, you'll need to do text comparisons:

```if ("1".equals(issue.get("customfield_10104")) &amp;&amp; "1".equals(issue.get("customfield_10105")))
return 1;
if ("1".equals(issue.get("customfield_10104")) &amp;&amp; "5".equals(issue.get("customfield_10105")))
return 9;

return 0; //or any other default value```

or else first convert the customfield values to integers using Integer.parseInt(issue.get("customfield_10104"))

### Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Marketplace Apps

### How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,373 views 0 8

### Atlassian User Groups

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

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.

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