Is it possible to edit an issue that's not the trigger-issue?

Niklas Malmberg
Contributor
March 1, 2024

My scenario is this: 

  • storyA with subtasks A1, A2 and A3. 
  • storyB with subtasks B1, B2
  • these two stories resides in same Jira project, but have no defined relationship apart from that.
  • Action performed by user: Subtask A3 is moved from storyA to storyB (parent change)
  • Task: Define an automation to recalculate story points for storyA and storyB

 

I have found a working trigger in "When value for Parent" and can from the trigger issue (subtask A3 find both the newParent (via fieldChange.toString + lookup issue (first), or simply via issue.parent) and also the oldParent (fieldChange.fromString + lookup issue (first)). 
Furthermore, I can recalculate the size of newParent storyB since it's the parent of the triggerissue. 

So far, all good.

But even though I can find the reference to oldParent storyA I'm currently stumped on how to edit anything in storyA, since EditIssue action always works on triggerissue... 

Is there a way to define on which object (in my example that would be story A) the EditIssue action edits?
Something similar to this in the EditIssue / Additional fields box:
{
"fields": {
  "[storyA].[Story point field]": {{lookupIssues.story points.sum}}"
  }

 

2 answers

1 accepted

0 votes
Answer accepted
Hariharan Iyer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 1, 2024

Hi @Niklas Malmberg ,

 

Something like this should work

Screenshot 2024-03-01 at 10.52.37 PM.png

Basically we store both the old and new parents in variables, and then create two separate branches for each of them using JQL. Here I'm just logging the parent keys, but you can do the calculations you need in those branches.

 

Hope that helps!

 

Hariharan Iyer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 1, 2024

Note that the reason this works is that - inside a branch - "issues" refers to the issues captured in that branch (in this case, those returned by the JQL) and not the trigger issue.

0 votes
Niklas Malmberg
Contributor
March 4, 2024

Indeed @Hariharan Lyer, this works!

(I was close but didn't manage to use the correct syntax for branch For: JQL . Your example works just fine.)

This also is an explanation to my question: Can editIssue edit anything else that triggerissue? And as you demonstrated, yes indeed, the issue.key reference inside the branch context depends on the branching statement.   

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events