Cloud Automation Rule To Append Request Participants From Linked Tickets
Asked by Dwayne Hammond:

Hello,

I've been exploring options to improve how our team handle client requests and have hit a hurdle on one idea. Hoping to get some clarification if I am missing an approach or if my research so far is correct in that this cannot be done cleanly.

The requirement is as follows: when a ticket of a specific Request Type transitions from status A to B, append the Reporter(s) and Requested participants from all linked tickets to the trigger issue. All required issues and tickets are in the same Project.

An example:

* Issue SD1 has Reporter 'Ben' and Request participants 'Jane' and 'Jim'
* SD1 also has two linked tickets, SD2 and SD3
* SD2 has Reporter 'Bob' and Request participants 'Adam'
* SD3 has Reporter 'Tim' and Request participants 'Sally' and 'Bill'
* Issue SD1 transitions from status A to B and triggers the automation
* The Request Participants field on SD1 is appended to include both Reporters and all Request participants from SD2 and SD3
* i.e. SD1 Request Participants goes from ('Jane', 'Jim') to ('Jane', 'Jim', 'Bob', 'Adam', 'Tim', 'Sally', 'Bill')

For the most part I can get this to work with the below rule:

* Trigger on status change from Awaiting Approval to Awaiting NOC
* Request Type = Client Update and linked issues present
* Create smart variable LinkedReporter initialised as NULL
* Create smart variable LinkedParticipants initialised as NULL
* Branch
  * All link types within same Project
  * Request Type is App Support
  * Create smart variable LinkedReporter using issue.reporter.accountId
  * Create smart variable LinkedParticipants using issue.Request Participants.accountId
* Set Request Participants to Copy from issue (retains existing) as well as LinkedReporter and LinkedParticipants

This works fine with zero or one linked ticket, but since the Branch runs parallel to the rest of the rule if there is more than one linked ticket the variables are still NULL when being used at the end. I can see that this parallel behaviour is expected and that without adding bloat (e.g. web request) there's no way to create a wait/delay.

I'm hoping that there might be a cleaner solution for what I am trying to do that bypasses these limitations though. What I've made above is done purely from searching online and testing so there's a good chance there is a simpler solution somewhere.

Thanks in advance!


Answers:
author: Kalyan Sattaluri
body: Hello [@Dwayne Hammond](/t5/user/viewprofilepage/user-id/5471253)

As [@Ste Wright](/t5/user/viewprofilepage/user-id/1166470)

You dont need branch.

You can do lookupIssues.

Assign your variables (LinkedReporter \& LinkedParticipants) values as he has shown.

Finally, Without seeing the values, I dont think you can directly assign these variable values to be added to the trigger issue like you are doing.

I believe you need to do "Advanced Edit" and format your JSON as per [Multi-user field syntax](https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#:~:text=customfield_11453%22%20%3A%20%7B%20%22id%22%3A%222s1863211f0z284c45269423%22%20%7D-,Multi%2Duser%20picker%20custom%20field,-Multiple%20users%20can). (\*I may be wrong and you can directly assign\*)

So please modify your rule, log the variables and share with us both the rule and audit so community can help.


author: Ste Wright
body: Hi [@Dwayne Hammond](/t5/user/viewprofilepage/user-id/5471253)

You could try using the "Lookup Issues" action?

You could...

* Lookup issues, using a linked issues JQL function - eg. *issue in linkedissues("")*
* Refer to the trigger issue's key using smart values - eg. *issue in linkedIssues("{{triggerissue.key}}")*
* Create the variables using the lookupIssues results, which can be multiple users rather than singular - eg. *{{lookupIssues.reporter.accountId}}*

This should allow you to modify "Request Participants" using multiple user results, rather than singular ones.

Ste