Scenario:
A team has requested that we append a group (defined in a Group attribute under an object schema they maintain as the CMDB) to a multi-group picker field within an issue using Jira automation.
Question:
Is it possible to do so? And, if so, how would that be setup?
Current attempt:
JSON:
{
"update": {
"MULTIPICKERGROUPfield": [
{"add":"objectAttribute":"lookupObjects.ASSETFIELD.objectAttribute}}"}
}]
}
}
Screenshots of layout:
Resulting Error:
ISSUE (Operation value must be an array of group objects (customfield_10810))
Both accessing asset data and creating dynamic JSON for the Edit Issue action can have timing problems leading to errors.
I recommend this approach to help mitigate / validate that:
Kind regards,
Bill
Hi, @Bill Sheboy
Thanks for the suggestion.
I've added the steps to define the variables at the beginning of the automation, after the lookupObjects action, but still seem to be running into an issue with what I'm passing to be appended.
Using your suggestions, I modified the JSON to the following:
{
"update": {
"multiGroupPickerField": [
{"add": "{{varJson}}"
}]
}
}
I'm getting the following though:
ISSUE-1 (Operation value must be an array of group objects (customfield_10810))
I'm assuming that I'm getting the group as a string, rather than any type of ID. And maybe that's the cause of the issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you write that variable to the audit log, does it contain what you expected? Is it a single value or a list of values?
And you are correct: I believe the ID is needed to set a field like that: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#Multi-user-picker-custom-field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, @Bill Sheboy
Correct - it's bringing in the string of the group name, rather than the group Id.
Working now to try and figure out how to easily get that converted using a web request at the beginning.
I'm presuming the path would be:
I've been trying to get the web request itself set up but seem to be running into a 403 error, despite having an API key. Note, I'm trying to also compensate for the group name (groupString) including spaces, hence my attempt with the encodeURIComponent.
If you have a moment, could I trouble you to check my syntax?
https://myorg.atlassian.net/rest/api/3/group?groupname={{encodeURIComponent(groupString)}}
For headers, I've got:
Thanks for any help you can provide.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe that endpoint is deprecated. Please try this one, and confirm your API token has sufficient permissions.
Tip for testing quickly on the permissions and URL: hardcode any parameters / data, and at the bottom of the Send Web Request action, use the "Validate your web request configuration" to repeatedly call it, adjusting as needed, until it works. Then switch back the parameters.
Next, the newer endpoint can only take a single query parameter for the group name. And so the workaround would be to pass no query parameter to get them all:
yourJiraURL/rest/api/3/groups/picker
Then build a regular expression by iterating over {{groupString}}, storing it in another variable. Finally use that to match against the web response to extract the ID values for building the dynamic JSON for the issue update.
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.