Forums

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

Copy data from linked work ticket to "trigger issue" via automation

Jeremy Schrek
Contributor
June 11, 2025

I have ticket structure that has linked work items to it via the "relates to" link. I wrote an automation that fires from a manual trigger. It currently gets a list of items with that link type (it "should" only be 1), once finds that ticket I want to copy custom field data from my linked work item to the trigger ticket.

 

This is where I am having the problem. I have tried two methods.

 

1. Method 1

Create a variable during the "For" section and after that fill in the trigger ticket custom field with that variable. The problem I found is the data is either being lost/cleared from the variable or I cannot access it when I am back to the main automation. 

 

image.png

 

Method 2:

Custom code in the "For" loop. With this I am having trouble updating the trigger issue and have not found great documentation other than "It acts like any issue". 

image (1).png

Code:

{
     "{{triggerIssue.fields}}":

      {
          "summary" : "{{issue.summary}}"
      }
}

1 answer

1 vote
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.
June 11, 2025

Hi @Jeremy Schrek 

Both of the methods you show use branches which could find more than one work item.  Branches of that type process in parallel and asynchronously, and thus any variables created inside the branch vanish after each item is looped over...and, there is no guarantee the branch will complete before the steps you show afterwards.

 

For your scenario you describe updating the trigger work item; please try using the Lookup Work Items / Issues action instead of using branching:

  • trigger: some trigger with your issue
  • ...other steps
  • action: lookup work items, with JQL to find the linked one based on the trigger and link type
    • issue IN linkedIssues("{{triggerIssue.key}}", "Math for")
  • smart values condition: to check only one was found
    • first value: {{lookupIssues.size|0}}
    • condition: equals
    • second value: 1
  • action: edit work item
    • rather than using JSON, just select the Summary field from the dropdown list and enter this smart value (or substitute your custom field):
      • {{lookupIssues.first.summary}}

 

For the link type in the JQL, please confirm that matches your needs by testing it with an example work item in a search.

 

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events