Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

When performing calculation using fields is the word "issue." required before it?

Madar_ Andrew
Contributor
May 22, 2024

When performing calculations using fields, is it required to add "issue." prior to the field?

I was getting some random values in calculation results and trying to figure out why.

For example:

should this work without issue?

{{#=}} {{addamonth}} * {{Monthly Approved Budget}} {{/}}

Or do I need to add "issue." prior to the field?

{{#=}} {{addamonth}} * {{issue.Monthly Approved Budget}} {{/}}

1 answer

1 accepted

0 votes
Answer accepted
Kalyan Sattaluri
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2024

Hello @Madar_ Andrew 

Is it required? - No.

it is implied that you are referencing the issue at hand.

But this "issue at hand"'s context is important for you to know.

When you are on main path, {{issue}} refers to trigger issue.

When inside a branch, {{issue}} refers to issues found based on your branch criteria. So in that case, if you want to reference issue which triggered the rule, you use {{triggerissue}}

If you have created an issue as part of your step, to refer to fields of this created issue, you use {{createdIssue.field}}.

So as you see, depending on where you are, what issue you want to reference, this keyword may be needed.

Please share screenshot if you are stuck.  Hope it helps. Thanks.

Madar_ Andrew
Contributor
May 22, 2024

I am using the IF branch, and performing the calculations on this branch.  Would I be required to use the issue or triggerissue prefix?

calculate estimated monthly cost.JPG

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2024

Hi @Madar_ Andrew 

Yes, and...to Kalyan's ideas:

Context is important for automation rules, and so let's look at an example rule to see which issue is "current" at different locations.

trigger: some trigger  At this point, "current issue", {{issue}}, and {{triggerIssue}} refer to the same thing.
action: some action same as above
branch: on some issues  same as above
         action: an action inside the branch Inside the branch, "current issue" and {{issue}} refer to the branched-to issue, but {{triggerIssue}} continues to be fixed. 
 action: after the branch After the branch, we are back to "current issue", {{issue}}, and {{triggerIssue}} refer to the same thing.

 

Another thing to watch for is list iterators, where the top-level of the iterator decides what is needed.  The issue prefix would rarely be needed for those cases.  Please look here to see more examples of those: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/#Combined-function-examples

 

Kind regards,
Bill

Like Madar_ Andrew likes this
Kalyan Sattaluri
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2024

For your rule, at least as far as shown:

  • Even if you dont give issue prefix, it will work,
  • Will work with issue prefix,
  • Will work with triggerIssue prefix.

So any of the 3 options above will give you the same result. It does not matter.

Now, if you are not seeing expected results, we have to look at your formulas.

So for that, you need to log all your values. So add below steps to your rule:

  • Add Component -> Then Add Action -> Select "Log Action". Put below value.
    • Monthly Budget is - {{Monthly Approved Budget}}
  • Add Component -> Then Add Action -> Select "Log Action". Put below value.
    • Addamonth value is - {{addamonth}}
  • Add Component -> Then Add Action -> Select "Log Action". Put below value.
    • Final Calculation is - {{#=}} {{addamonth}} * {{Monthly Approved Budget}} {{/}}

Once all added, run your rule and share your complete rule & audit log. 

Thanks.

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events