Add Users from Asset attribute to request participants
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
Add multiple users to request participants from an assets object attribute using automation.
Environment
Cloud
Diagnosis
When using automation to copy users to an issue field from an assets object attribute, only the first user is copied if the attribute holds multiple users.
Cause
This happens because the smart value for the assets object attribute returns an array when multiple users are in the attribute.
Solution
- In your automation, create a variable where you will store the users from your assets object user attribute; in the below example, the asset attribute that stores the users is called Owners, so the smart value is {{issue.customfield_####.Owner}}
In the Edit issue action, use additional fields and JSON along with list smart value operations to update the field:
JSON{ "update": { "Request participants": [ {{#Participants.substringBetween("[","]").split(", ")}} { "add": { "accountId": "{{.}}" } } {{^last}},{{/}} {{/}} ] } }
- In this example, we're updating the 'Request Participants' field, and our variable is called Participants; make sure to change it to match your environment.