Create work items across Jira Cloud instances with Automation
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
With two separate Jira sites, it's possible to use Automation to create work items in both sites at the same time. To accomplish this, we need to create two rules, one for sending a webhook from the source instance and one for receiving a webhook on the destination instance.
Solution
Best practices and tips
Create both automation rules at the same time, so you can easily copy and paste the value of the Webhook URL and secret
Start implementing this with only the summary and description fields, and improve by searching for the fields one by one afterwards
You can add the Log action on the rule(s) in order to understand what was inside the webhookData smart value, which helps identify the pattern we need to retrieve the fields we want
Automation rule on destination Jira instance
We'll actually start with the rule on the destination Jira instance. This allows us to copy the necessary webhook URL and secret which we'll use in the rule on the source instance later.
This rule needs to receive a webhook, and create a work item afterwards. The webhook URL and secret won't appear until the rule is saved and enabled.
Navigate to either your project > Project settings > Automation (for a project-scoped rule) or to global automation (for a globally scoped rule) and select Create rule
Trigger: Incoming Webhook
Action: Log action (optional)
Action: Create a new work item
Project: Select the project under your destination instance that must receive all the work items that will be created from the source instance.
Work item type: Select the type that the work item will be created as
If you need several work item types, you can add some conditions using the "If block condition" and create separate "Create work item" actions for each type of work
Summary and Description: Use Smart values to dynamically populate work item data from the Webhook
For the summary, use
{{webhookData.fields.summary}}
For the description, use
{{webhookData.fields.description}}
Add any other fields you want under the "Choose fields to set" option, and then use the same logic to get the field values from the webhookData object
Set a Name for your rule, and turn it on
Return to the Incoming webhook trigger
For Execute this automation rule with: Select Work items provided by webhook HTTP POST body
Webhook URL: We'll need to use this URL in the Webhook URL field of the source instance rule
Secret: This is the value for the rule's X-Automation-Webhook-Token on the source instance rule
Automation Rule on source Jira instance
This rule will send a webhook to the Jira destination instance whenever a work item is created on the source.
As mentioned, we'll need both the Webhook URL and Secret from the automation rule on the destination instance. Please copy and store these values temporarily until both rules are configured and working.
Navigate to either your project > Project settings > Automation (for a project-scoped rule) or to global automation (for a globally scoped rule) and select Create rule
Trigger: Work Item Created
Action: Log action (optional)
Action: Send web request
Webhook URL: Paste the URL of the incoming webhook trigger on the destination Jira instance
Headers: Insert the header X-Automation-Webhook-Token, and paste the webhook secret in the Value portion of this header
HTTP method: POST
This allows us to send information to the webhook URL
Webhook body: To simplify things, select Custom data and send all the required work item data using Smart values, which are placeholders for dynamic content
Custom data
{ "summary": "{{issue.summary}}", "description": "{{issue.description}}" }
Was this helpful?