Jira Automation to add linked issues' reporter and request participants to a ticket

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

Summary

The article helps us achieve the below mentioned use case: 

For service project A, we have Issue A, which is linked with issues X and Y. We aim to gather the reporter and the request participants of the linked issues of X and Y and add them to issue A.

The workaround provided can be used when multiple linked issues are linked to a main issue, request participants, and reporters of the linked cases are aimed at being added to the main issue as request participants.

Solution

Please check the article below to create an automation rule in the Jira cloud,

 For this automation rule, we will need the following action components.

  • Branch components

  • Lookup Issues

  • Create Variable

  • Edit Issue

  • Transition Issue

The structure of the automation rule will be as follows.

  1. Trigger component : “Issue Transitioned“.

  2. Create Variable:

    • Variable Name: ParentKey

    • Smart Value: 

      {{issue.key}}
  3. Add Re-fetch issue data

  4. Branch rule / related issues

    • Type of related issues: Linked issues

    • Link types: All link types (This can be specified)

    • Add comment to the issue

      • Message that wants to be given to the child issue users.

      • Check “Prevent duplicates by only adding this comment once to a particular issue.“ to prevent duplicate comments.

      • Comment visibility: Share with the customer

    • Transition Issue: Whichever status the child wants to be taken into should be selected.
  5. Another branch component will be added

    • Branch rule / related issues

      • Type of related issues: Current issue

    • Lookup Issues: JQL

      • project = <your_project_name> AND issue in linkedIssues("{{issue.key}}")
    • Create Variable:

      • Variable name: XYZ (can be selected different name)

      • Smart value: {{lookupIssues.Request participants}}

      • What does it do: Gathering the request participants from the Lookup issues component

    • Create Variable:

      • Variable name: XYZA

      • Smart value: {{XYZ.split(",").distinct}}

      • What does it do: Splits the duplicate users from the taken list.

    • Create Variable:

      • Variable name: accountIdList

      • Smart value: {{XYZA.replace("[","").replace("]","").split(",").asJsonStringArray}}

      • What does it do: Formatting the list as a string array to use it on the edit fields component.

    • Create Variable:

      • Variable name: emptyList

      • Smart value: {{accountIdList.replace("[","").replace("]","").replace(" ","")}}

      • What does it do: Taking the account id information and re-formats for the null check.

    • Create Variable:

      • Variable name: FinalList

      • Smart value: {{emptyList.replace("[","").replace("]","").replace(" ","").remove("\"\",").remove(",\"\"")}}

      • What does it do: Removes the empty indexes from the taken list.

    • Edit Issue:

      • Advanced fields options should be used with the following

        • {"update": {
            "Request participants": [
          {{#FinalList.split(",")}}{"add": {"id": {{.}}}}{{^last}},{{/}}{{/}} ,
          {{#lookupIssues.reporter}}{"add": {"id": "{{accountId}}"}}{{^last}},{{/}}{{/}}
            ]
           } 
          }

The outcome of the above automation rule will be gathering the request participants and reporter information from the linked tickets and adding it to the main ticket. Meanwhile, it will update the child tickets with a comment and transition them to a defined status.

Please see the automation rule for quick build up in the following.

Any further questions, please contact Atlassian Cloud support here.

https://support.atlassian.com/cloud-automation/docs/jira-automation-triggers/

https://support.atlassian.com/cloud-automation/docs/jira-automation-conditions/

https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-users/

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-rest-servicedeskapi-organization-organizationid-user-post

Last modified on Jan 17, 2025

Was this helpful?

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