Set destination issue custom field value with Automation Issue Linked trigger

maxtazov March 5, 2020

Hi,

I created a trigger Issue Linked with type Depending.

Also I added an action Edit Issue. 

I need to set custom field 1 value for the issue (issueA) that affects another issue with another custom field 2 value from the issue (issueB) that is depending on.

I set additional fields JSON as following:

{
"fields": {
"customfield_xxx": "{{destinationIssue.customfield_yyy.value}}"
}
}

But I got inverse result: the custom field 1 of issueB was set as custom field 2 of issueA.

When I try to change my JSON as

{
"fields": {
"{{destinationIssue.customfield_xxx.value}}": "{{issue.customfield_yyy.value}}"
}
}

I get error:

 Additional fields contains invalid field(s) in 'update' or 'fields' section: {{destinationIssue.customfield_xxx.value}}.

Is there any way to implement this logic using JSON?

Thanks in advance!

1 answer

1 vote
KJ March 7, 2020

I did something similar. 

I initially worked it out in JSON under More Options but was able to simplify it. 

When an issue is linked, copy a field value from the destination issue to the current issue. 

I chose the field to set and then entered this into the value:

edit issue.pngCustomfield_10091 holds the value that I want to copy to the Change Number field on the current issue. 

maxtazov March 10, 2020

Hi KJ,

Thank you for your answer. But in my case I need to set the field of destination issue. I found the decision by adding "Branch rule/related issues" component in my automation rule. This allows to set destination issue fields values.

Chris March 11, 2020

What was your branch rule?  When I use "destination" as the branch rule, I get two of the same issue back.  both 

Destination: {{destinationIssue}} Source: {{issue}} are the same thing.

Both  {{destinationIssue.custom field}} and {{issue.Item custom field}}} are the same now.

Like Lokeshpurohut likes this
KJ March 11, 2020

I didn't branch for this one. It looked like this:

2020-03-11_17-13-21.jpg

The first Edit issue field is what I showed earlier.

{{destinationIssue.customfield_10091}}

The Edit under Else looked like this so we didn't overwrite an existing value: 

{{issue.fields.Change Number.concat(destinationIssue.customfield_10091.leftPad(12, ", "))}}
maxtazov March 11, 2020

Hi Chris,

I set the type of related issues as "Linked issues" in the Branch rule. In this case I can set destination issue custom fields values as for current issue. To access the trigger issue fields I used {{triggerIssue}} (see comments in the Branch rule component.

 

issue_linked_edit_rule.png

Like # people like this
Chris March 12, 2020

Thanks Max!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events