Subtract the value of one custom field from the value of another custom field

Razinov V_N_ February 28, 2024

Hello community.

Today I am faced with such a problem. It is necessary to subtract the value of one custom field, customfield_10251, which is located in the linked task from the value of another custom field, customfield_10249, which is located in the parent task.
Field type is the same = Number Field
There are no errors when executing the automation rule, but the result is incorrect

{{#=}} {{issue.parent.fields.customfield_10249|0}} - {{issue.fields.customfield_10251|0}} {{/}}

value in field 10249 = 6 10251 = 3 (for example)

Screenshot 2024-02-28 at 11.51.55.pngScreenshot 2024-02-28 at 11.52.17.pngScreenshot 2024-02-28 at 11.52.50.pngPerhaps someone can help me solve this problem

1 answer

1 accepted

1 vote
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 28, 2024

Hello @Razinov V_N_ 

Please show us the complete rule. What is the trigger of the rule?

Also please show us the output in the Audit Log for the rule's execution.

Lastly can you show us the issue details for an issue where this rule would be triggered, and point in that image to the issue you consider its parent?

 

I believe the problem is probably here:

{{#=}} {{issue.parent.fields.customfield_10249|0}} - {{issue.fields.customfield_10251|0}} {{/}}

You are trying to use {{issue}} to refer to two different issues, and that is not possible.

If that second value is in the issue that triggered the rule you need to instead use {{triggerIssue}}. And note that the "i" for "Issue" needs to be capitalized.

{{#=}} {{issue.parent.fields.customfield_10249|0}} - {{triggerIssue.fields.customfield_10251|0}} {{/}}

Razinov V_N_ March 1, 2024

I changed the request a little and everything worked

{
   "update": {
      "customfield_10249": [
         {
            "set": {{#=}}{{issue.fields.customfield_10249|0}} - {{triggerIssue.fields.customfield_10251|0}}{{/}}

         }
      ]
   }
}

Suggest an answer

Log in or Sign up to answer