Hi everyone
I'm trying to provide a numeric score against different types of values submitted in a custom field, e.g, when 'effort' is marked as XXS the value should be -0.25 but when it's marked as XS it should be a value of -0.5 etc. I have written the following code for an automation but when I have anything more than the first row the result is always a sum of the values, i.e. -0.75 (-0.25 +-0.5). What am I doing wrong?
{{#if(equals(epic.Effort,XXS))}} -0.25 {{/}}
{{#if(equals(epic.Effort,XS))}} -0.5 {{/}}
Many thanks
Hey John
Thanks so much for coming back to me. Screenshot attached:
I know I could use the drag and drop 'if else' that jira automation uses but I have many, many of these rules to operate and, in the end, to sum the results of. I believe it's more efficient to code it (if it works).
Many thanks
Emma
HI Emma,
Can you share the entire rule that you have so far?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have not tried two different values for a single variable like that before. Make create two separate variables and use conditions to check if each is > 0 or not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi John.
No worries. I appreciate the response anyway and am pleased to tell you I have a solution. I got my head together with a magic office fairy who was able to come up with this solution:
{{#math}}
IF({{issue.Effort.value.indexOf("XXS")}}=0,-0.25,0) +
IF({{issue.Effort.value.indexOf("XS")}}=0,-0.75,0) +
IF({{issue.Effort.value.indexOf("S")}}=0,-1,0) +
IF({{issue.Effort.value.indexOf("M")}}=0,-2,0) +
IF({{issue.Effort.value.indexOf("L")}}=0,-3,0) +
IF({{issue.Effort.value.indexOf("XL")}}=0,-4,0) +
IF({{issue.Effort.value.indexOf("XXL")}}=0,-5,0) +
IF({{issue.Impact.value.indexOf("S")}}=0,0.25,0) +
IF({{issue.Impact.value.indexOf("M")}}=0,0.5,0) +
IF({{issue.Impact.value.indexOf("L")}}=0,1,0) +
IF({{issue.Impact.value.indexOf("XL")}}=0,2,0) +
IF({{issue.Impact.value.indexOf("XXL")}}=0,3,0) +
IF({{issue.Confidence in achieving the impact.value.indexOf("0-50%")}}=0,0,0) +
IF({{issue.Confidence in achieving the impact.value.indexOf("50%")}}=0,1,0) +
IF({{issue.Confidence in achieving the impact.value.indexOf("80%")}}=0,2,0) +
IF({{issue.Confidence in achieving the impact.value.indexOf("100%")}}=0,3,0) +
IF({{issue.Cost of delay.value.indexOf("A slap on the wrist")}}=0,0.5,0) +
IF({{issue.Cost of delay.value.indexOf("Should really do this")}}=0,1,0) +
IF({{issue.Cost of delay.value.indexOf("This is a big deal")}}=0,2,0) +
IF({{issue.No miss.value.indexOf("Yes")}}=0,100,0) +
IF({{issue.Strategic Roadmap.value.indexOf("Directly supports the strategic roadmap")}}=0,6,0) +
IF({{issue.Strategic Roadmap.value.indexOf("In part supports the strategic roadmap")}}=0,4,0) +
IF({{issue.Strategic Roadmap.value.indexOf("Very lightly supports the strategic roadmap")}}=0,2,0) +
IF({{issue.Strategic Roadmap.value.indexOf("Nope. This doesn't a support it (kudos for honesty)")}}=0,2,0) +
IF({{issue.Target Date.value.indexOf("3 months")}}=0,3,0) +
IF({{issue.Target Date.value.indexOf("3-6 months")}}=0,2,0) +
IF({{issue.Target Date.value.indexOf("6-9 months")}}=0,1,0) +
IF({{issue.Target Date.value.indexOf("Not applicable")}}=0,0,0) +
IF({{issue.Tech Debt.value.indexOf("Adds Tech Debt")}}=0,-1,0) +
IF({{issue.Tech Debt.value.indexOf("No impact")}}=0,0,0) +
IF({{issue.Tech Debt.value.indexOf("Remove tech debt")}}=0,1,0) +
IF({{issue.What's the reach?.value.indexOf("0-10%")}}=0,0.25,0) +
IF({{issue.What's the reach?.value.indexOf("10-25%")}}=0,0.5,0) +
IF({{issue.What's the reach?.value.indexOf("25-50%")}}=0,1,0) +
IF({{issue.What's the reach?.value.indexOf("50-75%")}}=0,1.5,0) +
IF({{issue.What's the reach?.value.indexOf("75-90%")}}=0,2,0) +
IF({{issue.What's the reach?.value.indexOf("90-100%")}}=0,3,0)
{{/}}
Each of the sections represents a different field I was giving a value to. The formula breaks down as follows with each variable being pre/suffixed with an asterisk:
IF({{issue.*fieldname*.value.indexOf("*value*")}}=0,*Lookupvalue*,0)
This section: indexOf("*value*")}, looks up the value and returns its first character position. Given that am looking for the full value I know that its position must be 0 for it to be what I'm looking for. I determine this here: indexOf("*value*")}}=0. When that is true it returns the lookup value or zero if it's false. That means adding them together gives me the total sum. Currently, this will not work if someone leaves a null value, i.e they deleted the field's contents. I may have to ask for some more help from my magic fairy...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi John
Yes, indeed! See my last post above. This did what I needed it to do very well.
Thanks
Emma
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.