How to create multiple sub-tasks based on a multi-select Assets custom field using Automation
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Scenario
For the purpose of this article, we'll consider the following scenario:
- In an Onboarding request, it is necessary to create sub-tasks for each asset selected on the request form, so the IT team can properly setup the onboarding user's access, prepare their computer and accessories, etc.
To accomplish this, we'll leverage automations in a Service project.
Prerequisites
There's only two prerequisites for this scenario:
- Your Asset field must allow multiple objects to be stored within it
- Have sub-tasks setup on your Service project: Configuring sub-tasks
Preparing the Request Type
For simplicity's sake, in this scenario we'll be using a simple Request Type, that captures the Onboarding user's name in the Summary field. This is relevant when setting up the automation action that creates the sub-tasks:
The Automation
The automation we're building is actually quite simple, it can be defined by the following steps:
- WHEN a new Onboarding ticket is created;
- FOR EACH Asset, create a new sub-task.
To achieve that, we'll use the following Automation components:
- Trigger: We'll use the Issue Created trigger;
- Condition: We'll use a Issue fields condition on the Request Type field to make sure the automation will not misfire on unrelated requests;
- Advanced Branching: this component will define our FOR EACH "loop" that creates a separate sub-task for each asset informed on the "Onboarding Assets" field;
- Action: Create Issue - this action will be used to create the sub-tasks.
For our example, the Advanced Branch and Create Issue actions should look like so:
Smart values used:
- {{issue.Onboarding Assets}} - This smart value is used on the Advanced Branching component, to fetch each individual object key of the objects added to our "Onboarding Assets" field. It can be used within the branch using the smart value {{asset}}, per the examples above.
- {{issue.summary}} - In this example, this smart value will contain the summary of the original Onboarding request, therefore the employee's name.
Optional - Lookup objects action inside the branch
Optionally, we can add a Lookup Objects action within the branch in order to fetch additional information from the objects, as the branch smart value will provide us only the object's key as text, not the object itself:
With that, we can then use the object's name (or other information) to add to the Summary on the sub-tasks:
Smart values used:
- {{lookupObjects.Name}} - This will contain the Name of the object being used to create the sub-task.
Final results
With the added Lookup Objects action in the example above, a new Onboarding ticket should successfully create sub-tasks in the following format: Asset Onboarding - Employee Name - Asset Name:
Additional Resources
Be sure to also check out our article on Assets smart values: Jira smart values - Assets