I'm trying to do a point spread auto calculation for a selection list with smart values.
List values are field multi-select items which users select when they create/edit their tickets.
Example:
Solution Change Type:
- Software
- Network
- Content
- Content in Software
- etc.
Can't get the syntax right. What I want is my value if the item is selected and a zero if it is not selected.
Trigger: When value changes for "Solution change type" change
Action: Edit issue fields > Story Points
Example of desired calculation.
{{#math}}
IF(exists({{issue.Solution Change Type.get(0).value}}),2,0) +
IF(exists({{issue.Solution Change Type.get(1).value}}),1,0) +
IF(exists({{issue.Solution Change Type.get(2).value}}),1,0) +
IF(exists({{issue.Solution Change Type.get(3).value}}),1,0)
{{/}}
I've tried a number of variations but I either end up with ' + + + + +' or
This can be done in one step with a field edit
{{#math}}
{{issue.Solution Change Type.size|0}}
+ IF({{issue.Solution Change Type.join("_").indexOf("CHC Software")}}>=0,2,0)
+ IF({{issue.Solution Change Type.join("_").indexOf("On-Prem Infra")}}>=0,3,0)
+ IF({{issue.Solution Change Type.join("_").indexOf("Content Changes (outside software code)")}}>=0,1,0)
{{/}}
We just added up the values and then found specific items we wanted to count more than 1 point for (giving weight to those kinds of tickets).
Not precise, but good enough.
Thanks!
Hi @Leeland
If I am understanding your question, you want to sum values when items from your multiple-select field are selected AND it appears that some of those values have different summing values. Is this correct? If so...
Yes, you are correct: get() returns a value from a smart value list, and for your field it will only return selected choices...not the entire list, 0 to n-1, with a setting of "on" and "off".
So you probably have limited options for Jira Server automation:
Best regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Assume I want to do it the really hard way. Can you give me a snippet to make that work? This is something we can let take a long time in the background and doesn't happen very often.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay, perhaps something like this:
I have also seen community posts where people "bundle" data, storing the incrementor in the field definition and summing them later. (DBAs dislike that :^) For example:
You may then get all of the values and sum them in one step in a rule, using a regular expression to extract the values and list functions to sum them up.
Good luck!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, that almost works. I built this:
But, Story Points is being set to 3 instead of the expected 4.
I might have figured out a single pass with this style:
{{#math}}
IF({{issue.Solution Change Type.join("_").indexOf("CHC Software")}}>=0,2,0)
+ IF({{issue.Solution Change Type.join("_").indexOf("On-Prem Infra")}}>=0,3,0)
+ IF({{issue.Solution Change Type.join("_").indexOf("Content Changes (outside software code)")}}>=0,1,0)
{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yup, that second way should work also. In that approach, you can set the Story Points in one step and no re-fetch calls are needed.
Make sure you test the edge cases of no values and all values selected to confirm you get what you wanted.
__Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.