I'm not sure that my summary is descriptive enough, so here is my use case.
Issues are created in the project via an external form. Part of that form allows submitters to select a department and one or more countries. When multiple countries are selected, they are separated by a carriage return "\n".
The created task is then assigned based on the selected department and subtasks created for each selected country. Here's what my automation (triggered on issue create) does:
- Scrapes the description for the department
- Looks up the department in a lookuptable and returns a userID
- Assigns the issue to the ID
- Scrapes the description for the countries {{countryList}}
- For each country: {{countryList.split("\n")}}
- Lookup the country in a lookup table for a userID
- If the userID is the assignee of the task, then add the country as a label
- If the userID does not match the assignee of the task, create a subtask
Note, steps 5-2 and 5-3 are two separate For each: Smart value loops.
So basically, if a user is assigned to a tasks department and one or more countries, they will only be assigned the original task and no subtasks will be generated. Users that aren't assigned to the department will get a subtask for each selected country for which they are responsible.
That all works great, but here is what I need to figure out:
Is it possible to create just one sub-task for each unique sub-task assignee instead of multiple?
For example, user1 is assigned to countries Spain, France and Italy. user 2 is assigned to UK, Canada. A task is created that isn't assigned to either one of them. Two subtasks should be created, The first one assigned to user 1 with the labels "Spain", "France" and "Italy", the second subtask assigned to user2 with the labels "UK" and "Canada". As of right now, my automation creates a subtask for each.
I can't think of a reliable method to do this because of the limited options inside the For each loop.

