Automation rule to copy users associated with a project role into a multi user picker field

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

    

Summary


This KB outlines the steps to configure an automation rule to copy users associated with a project role into a multi user picker field.

Environment

Jira Cloud

Solution

Pre-requisite:

  • Create a custom field of type User Picker (multiple users) and add it to the screens associated with the required issue types. Make a note of the custom field ID to use it in the Advanced field editing.
  • Get the ID of the required project role using the Get all project roles.
  • Lets consider 10002 is the id assigned to the Administrators project role and the requirement is to update the user picker custom field with the associated users.

Automation Rule Configuration: 

Trigger: Choose the trigger as per your requirement.  

Condition: Add a condition to check issue types if required

Actions:

Action 1: Create Variable: If it's a Global rule, create a variable to capture the project ID for later use. 

Action 2: Send web request: Update the fields as below

  • Web request URL: https://<sitename>.atlassian.net/rest/api/3/project/{{projectid}}/role/10002
  • HTTP method: GET
  • Web request body: Empty
  • Ensure to select "Delay execution of subsequent rule actions until we've received a response for this web request"
  • Headers (optional)

Action 3: Edit Issue

Choose More Options to edit the issue through Advanced field editing. Add the below JSON:

{
    "fields": {
        "customfield_xxxxx": [
           {{#webResponse.body.actors.actorUser}}
           {
                "accountId": "{{accountId}}"
            }
        {{^last}},{{/last}}
        {{/webResponse.body.actors.actorUser}}
       ]
    }
}

Note: customfield_xxxxx is the id of the multi user picker custom field.


Last modified on Jan 3, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.