Hi there,
I'm new to Jira Automation (Cloud) and trying to create an automation rule that creates subtasks for users in a selected group from a custom single group field. yep, not an easy task for a beginner...
What I try to achieve
This screenshot shows my idea how to achieve my goal, but is not finished yet.
However, I managed to iterate over a given hardcoded groupName (in web request) and get users from it to create the subtasks.
Assume the variable groupName is a group name with spaces in it. Unfortunately https://mydomain.atlassian.net/rest/api/3/group/member?groupname={{groupName}} only works if the group has no spaces in it.
Obviously it must be encoded for use in url, and I until now I was not able to do this.
So I decided to us the group id and request the api: https://mydomain.atlassian.net/rest/api/3/group/member?groupId=123456789
This might work with a single, harcoded groupid in Web request URL.
My Problem
However, my problem is quite simple: When I switch from hardcoded groupId/groupname (in web request url) to retrieving groupId from custom single group field, the value is always null.
My custom field has the name "Training Group" with the field id "customfield_10322".
"https://mydomain.atlassian.net/rest/api/3/issue/<issue-key>?expand=names" shows that the following attributes are available for customfield_10322
"customfield_10322": {
"groupId": "123456789",
"name": "Training group",
"self": "https://mydomain.atlassian.net/rest/api/3/group?groupId=123456789"
},
However, I can't get the groupId attribute via smart value. The value is always null.
Neither with SmartValue {{issue.customfield_10322}} nor {{issue.customfield_10322.groupId}} or {{issue.fields.customfield_10322.groupId}}.
To simplify things, I've created a manually triggered rule that logs to the audit log.
I'm curious to know what's my mistake and would really appreciate your tips.
If there is a better or simpler solution for my goal I would like to hear your suggestions.
Thanks in advance, this is driving me crazy for hours...
Regards, Tim
Hi @Tim
First thing, well done trying to diagnose this one for your rule!
This seems to be a known problem, and here is a suggestion to fix it: https://jira.atlassian.com/browse/AUTO-890
Your workaround could be to use the group name to get the users, adding the urlEncode() function to manage the embedded spaces:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#urlEncode--
Kind regards,
Bill
Hi Bill,
Thanks for your help. I've been looking for this kind of "bug" ticket with no success. Glad to see this one is already created (+Vote and comment added).
The workaround is great! I tried playing around with the smart value text functions until I realised that they only work when I get {{issue.customfield_10322.name}}. If I only get {{issue.customfield_10322}}, the name is logged in the audit log, but the functions do not work.
Best regards,
Tim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Edit: Updated automation rule with conditions to check if the web requests return values (not empty) and if subtasks habe already been created (no check for specific subtask).
That was fun, Jira automation is quite powerful, but hard to master. Thanks again for your help, Bill!
For documentation purpose, here's the complete rule. This one works for my needs (number of groupmembers < 50).
If
the following rule
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, done! I have two suggested improvements to your rule:
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.