How to get a sum value from an Advanced Link table and copy it into a custom field
Use case
An Advanced Link field Invoice is used to link invoice issues to an issue representing the vended service. In issue view Advanced Link field is displayed in style Table and a sum of the Paid Amount field from linked invoices is displayed as well.
Requirement
Retrieve the sum of values from the field Paid Amount in linked issues and copy the sum into a custom field with the same name but within the current issue.
Solution
An automation rule can be configured to retrieve the linked issues → sum up the values within a specific field → insert the value into a new custom field:
Send a web request to get linked issues (see REST API ).
Mark the checkbox to delay execution of subsequent rule actions until automation has received a response for the web request.Create a variable for the following smart value:
{{webResponse.body."Deal/Service - Invoice"."Invoiced via".linkedissues}}
,
where"Deal/Service - Invoice
is the name of the Advanced Link configuration, and"Invoiced via"
is the name of the Advanced link (inward/outward).Look up retrieved issues:
Create a variable for the value of the custom field (in our case, Paid Amount)
{{#lookupIssues}},{{customfield_id}} {{/}}
:Summarize the field values with a formula
{{sum.substring(1).split(",").sum}}
:Copy the summed-up values into a required field:
Rule configuration is also available for downloading as a JSON file:
© 2023, STAGIL