Deep Clone for Jira integrates with Jira Automation in different ways, depending on your use case.
-
Single work item clones: Use the Jira Automation Clone Action.
-
Epic/ Tree clones: Use Deep Clone Post Functions together with (global) looping transitions.
You can also trigger Jira Automation on the work items created by Deep Clone:
-
With smart values, when using the Jira Automation Clone Action.
-
With an incoming webhook.
Trigger Deep Clone with the Jira Automation Clone Action
Clone individual work items with Jira Automation Rules.
Deep Clone provides the Jira Automation Rule action “Deep Clone - Single Clone” for cloning a single work item.
Clone A Single Work Item With A Jira Automation Rule
Prerequisites
-
Create a Jira Automation Rule with a trigger and any steps that you want to execute before the work item clone, following Atlassian's Jira Automation Documentation.
Adding A Single Work Item Clone Action
-
Open the configuration of your Jira Automation Rule
-
Click on + Add Component
-
Choose THEN: Add an action
-
In the Search actions box, search for “Deep Clone”
-
In the result list, select “Deep Clone - Single Clone”
-
Confirm the message “Before you can use this component, you'll need to connect Atlassian Automation” by clicking Connect. Deep Clone executes the clone as if the connected user had triggered the clone. Make sure that the connected user has all necessary permissions.
-
Fill in the action’s configuration:
-
Source Work Item Key: The key of the work item to clone. Enter either a fixed work item key or a smart value expression that resolves to different values depending on the execution context of your automation rule. Browse the available smart values by clicking the {} button to the right of the input field.
-
Preset: The preset for the clone configuration. This preset determines the settings that will be used for the clone. Choose a preset from the dropdown or click the {} button to switch to the smart value input mode which allows you to enter a smart value expression that resolves to different values depending on the execution context of your automation rule.
-
Target Space: The target space for the clone. Choose a target space from the dropdown or click the {} button to switch to the smart value input mode which allows you to enter a smart value expression that resolves to different values depending on the execution context of your automation rule. This configuration is optional. If you don’t set a target space here, Deep Clone clones to the target space configured in the preset.
-
Target Work Type: The target work type for the clone. Choose a target work type from the dropdown or click the {} button to switch to the smart value input mode which allows you to enter a smart value expression that resolves to different values depending on the execution context of your automation rule. This configuration is optional. If you don’t set a target work type here, Deep Clone clones to the target work type configured in the preset.
-
-
Click on Next to finish the configuration.
Using the Single Work Item Clone Action Output
The action outputs information about its results as smart values that can be used in subsequent automation actions. The following outputs are available:
-
{{triggeredDeepCloneWorkItem.status}}: The status of the clone action at the time that the action returned control to the automation. As automations action have a maximum runtime of 25 seconds, the action might return before the clone is finished, which will be indicated in this output field. The possible statuses are:
-
INITIALIZED: The job is not finished yet. So far, no work items clones have been created.
-
CREATED: The job is not finished yet. At least one work item clone has already been created.
-
SUCCESS: The job is finished. All work item clones have been created.
-
PARTIAL_SUCCESS: The job is finished. Some work item clones were created successfully, some work item clones could not be created due to errors.
-
ERROR: The job is finished. No work item clones could be created due to errors.
-
-
{{triggeredDeepCloneWorkItem.workItemId}}: The id of the first work item clone that the action created.
-
{{triggeredDeepCloneWorkItem.workItemKey}}: The key of the first work item clone that the action created.
-
{{triggeredDeepCloneWorkItem.spaceId}}: The id of the space in which the action created the first work item clone.
-
{{triggeredDeepCloneWorkItem.spaceKey}}: The key of the space in which the action created the first work item clone.
-
{{triggeredDeepCloneWorkItem.workTypeId}}: The id of the work type with which the action created the first work item clone.
-
{{triggeredDeepCloneWorkItem.workTypeName}}: The name of the work type with which the action created the first work item clone.
-
{{triggeredDeepCloneWorkItem.allWorkItemIds}}: A comma-separated list of the ids of all work item clones that the action created. If the action has status SUCCESS, PARTIAL_SUCESS or ERROR, this list contains all created work items. For other statuses, the list only includes the work items that have been created so far and further work items might be created as the clone continues to run in the backend.
-
{{triggeredDeepCloneWorkItem.allWorkItemKeys}}: A comma-separated list of the keys of all work item clones that the action created. If the action has status SUCCESS, PARTIAL_SUCESS or ERROR, this list contains all created work items. For other statuses, the list only includes the work items that have been created so far and further work items might be created as the clone continues to run in the backend.
-
{{triggeredDeepCloneWorkItem.messageJson}}: This field contains warning and error messages generated during the clone process. The JSON object has the following structure:
{ "<SourceWorkItemKey>: { <CloneActionKey>: <Messages (comma-separated)> ... } }For example:
JSON{ "TEST-1": { "reporter": "Reporter was not among editable fields.", "assignee": "You do not have permission to edit issues in this project." } }
Managing Permissions for Jira Automation Clones
Deep Clone executes the clone as if the connected user had triggered the clone. Make sure that the connected user has all necessary permissions.
Tracking Jira Automation Clones
Check the Jira Automation Clone tab in the Clone History to see all clones that were executed by the Deep Clone Jira Automation Action.
Only Administrators and the user to which you connected the Deep Clone Jira Automation Action can see the clones in the Clone History.
Trigger Deep Clone from Jira Automation with a Workflow Post Function
This article describes how to trigger Deep Clone from Jira Automation using a Deep Clone post function and a (global) looping transition, where the origin and destination statuses are the same (Recommended for Epic/Tree Clones).
You can also trigger Deep Clone using the Deep Clone Jira Automation action (Recommended for Single Clones).
This is how you can set up a Jira Automation with (global) looping transitions.
-
Add a global looping transition to your workflow.
-
Add a Deep Clone post function to the looping transition.
-
Create a new Jira Automation rule with an action that triggers the looping transition.
-
Click on “+ add regex to distinguish between multiple transitions to the same status”
-
Define a transition match with the name of your global looping transition (e.g. Clone), to make sure that the correct transition is triggered.
-
Now you can trigger a Deep Clone via Jira Automation without changing the status of a work item.
Make sure that your automation rule doesn’t cause a loop that creates infinite clones. Work items that are created with Deep Clone can trigger automations of “Work item updated” rules.
-
Global looping transitions can be removed from the work item view by adding the condition “Hide from User” to the transition.
-
If Deep Clone and Automation overwrite each other, you could insert a ‘refetch work item data’ action immediately after the trigger in Automation for Jira. In ‘more options’ you can manually configure a delay which would solve your problem.
-
Read more about creating global looping transitions in the Atlassian Community.
-
Read more about Jira workflows in the Atlassian documentation.
-
Read more about Jira automation in the Atlassian documentation.
Trigger a Jira Automation From Deep Clone (Incoming Webhook)
There are two ways to trigger Jira Automation on work items created by Deep Clone: use the Jira Automation Clone Action together with smart values or configure an Incoming Webhook.
This page describes the Jira Automation Incoming Webhook approach.
Just create a Webhook (using the first option, “Work items provided in the webhook HTTP POST body”) and adjust Deep Clone with the Webhook URL and adding the Secret at the end of the URL:
Make sure that the Jira Automation rule is either global or, if it’s a “Space (Project) rule”, within the target space where the cloned work item is created.
Beware of infinite loops between Jira Automation and any Workflow Post Functions, possibly triggered by Jira Automation as well.
Read More