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,556,538
Community Members
 
Community Events
184
Community Groups

Using Calculated Number Field - Cascading Select List

Edited

I am using the Calculated Number Field to calculate a sum based on the values of a Cascading Select List.  I am using the following code in a Calculated Number Field:

<!-- @@Formula:

var casOption1 = issue.get("customfield_14001").get(null);
var casOption2 = issue.get("customfield_14001").get("1");

var WouldHave = "Would Have";
var GeneralFeedback = "General Feedback";

int casval1 = 0;
int casval2 = 0;
int progress = 0;

var value1 = casOption1;
log.error("The value for the first option is " + value1);

var value2 = casOption2;
log.error("The value for the second option is " + value2);

if (casOption1.equals(WouldHave)) {
casval1 = 1;
}

if (casOption2.equals(GeneralFeedback)) {
casval2 = 2;
}

int progress = casval1 + casval2;
return progress;

-->

In the logs I get:

2017-05-22 11:23:17,347 http-nio-8080-exec-19 uri:/jira/secure/ProjectIssueNavi...%21issueViewWithSidebar.jspa username:ericv ERROR ericv 683x237003x1 ajkb4x 10.84.131.145,10.84.32.19 /browse/FBI-177397 [c.i.jmcf.fields.CalculatedNumberField] The value for the first option is Would Have
2017-05-22 11:23:17,348 http-nio-8080-exec-19 uri:/jira/secure/ProjectIssueNavi...%21issueViewWithSidebar.jspa username:ericv ERROR ericv 683x237003x1 ajkb4x 10.84.131.145,10.84.32.19 /browse/FBI-177397 [c.i.jmcf.fields.CalculatedNumberField] The value for the second option is General Feedback

It seems like the code is correct but the IF statements (casOption1.equals(WouldHave)) and (casOption2.equals(GeneralFeedback)) are not setting the value in casval1 or casval2 even though the logs are saying these are equal to what I have specified.

Is there anything special that needs to be done with these IF statements for cascading select lists?  Thank you.

1 answer

0 votes
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 08, 2022

Hi @Eric_Vincent 

I don't know if you have already found a solution, but perhaps this could help you. Single select fields usually have options. And I think that you can't simply set the variable equal to something else. You have to set the option.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events