How can I append a group defined in Asset attribute to a multi-group picker field within an issue?

Garrett Richardson February 19, 2025

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:

Screenshot 2025-02-19 at 10.58.25.png

Screenshot 2025-02-19 at 11.03.png


Resulting Error:

 

ISSUE (Operation value must be an array of group objects (customfield_10810))

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2025

Hi @Garrett Richardson 

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:

  • use the create variable action to built the dynamic JSON first, perhaps named varJson
  • write the variable {{varJson}} to the audit log to check the contents
  • use the variable {{varJson}} in the Edit Issue action

Kind regards,
Bill

Garrett Richardson February 19, 2025

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? 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2025

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

Garrett Richardson February 20, 2025

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:

  1. lookupObjects action
  2. Define variable {{groupString}}
  3. Send web request to Jira API 
  4. Parse response for groupId

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: 

  • Content-Type
    • application/json
  • Authorization
    • myEmailAddress:API Key
  • Accept
    • application/json

Thanks for any help you can provide. 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 20, 2025

I believe that endpoint is deprecated.  Please try this one, and confirm your API token has sufficient permissions.

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-rest-api-3-groups-picker-get

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.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events