Hi everyone,
I have an automation that is triggered when an issue of type "Initiative" is created. Its goal is to populate a custom field "Squads contributing" based on the group the reporter belongs to.
Current Setup:
Challenges:
High Maintenance:
Technical Limitations:
Question:
Is there a simpler or more efficient way to handle this use case? For example:
I don’t have ScriptRunner in my environment, so solutions need to rely on standard Jira automations or feasible alternatives within this scope.
Thank you in advance for your help and ideas!
I recommend using a Lookup Table for such mapping scenarios: https://community.atlassian.com/t5/Automation-articles/Update-Create-lookup-table-action-improvements/ba-p/2427798
With that, your rule would reduce to only a few steps rather than conditions for each group:
Maintenance is easier and isolated to updates to the lookup table.
What do you want to do if there is no match to the Reporter?
Kind regards,
Bill
UPDATED 2024-12-13: I replaced the steps to call the REST API to instead use the new groups smart value for the user object.
Hello Bill,
Thank you for your response.
I’ve thoroughly read all the documentation provided, but I still can’t resolve this issue, nor do I know how to control the results from the API call.
In the meantime, Atlassian support suggested another approach: using a smart value to retrieve the list of the reporter's groups {{reporter.groups}}
and then searching for the value I need within that list. I can retrieve the list, but I can’t filter it to extract only the group I’m interested in. Here’s the smart value I’m using:
First log action:
{{reporter.groups}}
Second log action:
{{#if(not(reporter.groups.isEmpty))}}
{{#forEach(reporter.groups)}}
{{#if(equals("bot-group-tpm", .))}}
Found group: {{.}}
{{/if}}
{{/forEach}}
{{else}}
Not found
{{/if}}
And here’s the result:
Thank you,
Nicolas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, I just learned something new: the user smart value now provides "groups".
Let's modify the approach I described earlier to use that information...
Testing indicates the groups smart value appears to be one of the dynamic smart values, which is found just-in-time when it is used. And so to query it, the values must be saved as text first.
Assuming your Squads all have group names matching a pattern, such as "bot-group-ABCD", you could still use the lookup table approach:
I will update my first post to handle this new method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Bill Sheboy ,
Thank you very much !
It works perfectly with the lookup table and its way easier to maintain than my previous automation.
Thank you again!
Nicolas
Edit:
Actually, I realized that the lookup table wasn't necessarily needed.
So, with the two variables, I can update my group field.
It's even better because there’s no maintenance required for this automation.
Step 1:
Trigger
Step 2:
Create variable:
variable: varReporterGroups
Smart value: {{isue.reporter.groups}}
Step 3:
Create variable:
variable: varSquadGroup
Smart value: {{varReporterGroups.split(", ").match("(bot-squad-,++)")}}
Step 4:
Edit issue:
My_Customfield: {{varSquadGroup}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome, and well done!
Shouldn't that comma in the expression be a period (any character token)?
{{varReporterGroups.split(", ").match("(bot-squad-.++)")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.