Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Razinov V.N. February 28, 2024 edited

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.png Screenshot 2024-02-28 at 11.52.17.png Screenshot 2024-02-28 at 11.52.50.png Perhaps 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
TAGS
atlassian, team '25, conference, certifications, bootcamps, training experience, anaheim ca,

Want to make the most of Team ‘25?

Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.

Learn more
AUG Leaders

Upcoming Jira Events