In Insight, we defined an object 'Systems' which have a 'Support Team' attribute. This Support Team attribute is a User field with cardinality of 'unlimited' (i.e. a multi-user field).
In JSM, we have a multi-user field 'Support Team'
In Automation, we want to copy the users from the 'Support Team' object to the jira field Support Team.
I tried many different things in Automation, but so far, it only works when the Support Team attribute in Insight only has one user.
I tried the followin in an Automation Rule, which only works for one user in the insight attribute:
For the lookupObjects IQL, This retrieves the 'System' object
objectType = "System" and Name = "{{issue.customfield_10067.Name}}"
This always returnes the correct Insight Object, no issues there
the next action: Edit Issue: -> More options
{
"fields": {
"Support Group Members":{{lookupObjects."Support Team Level 1".asJsonObjectArray("accountId")}}
}
}
I tried many combinations, including multiple ways of using 'asJsonObjectArray("accountId") as described here: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-json-functions/.
The main problem seems to be with the function asJsonObjectArray("accountId") for a field with multiple users: instead of producing something like this (like the documentation suggests):
[{ "accountId": "613bd50411d5e10071d3c6e3" }.{ "accountId": "12345678809i324" }]
It produces this:
[{ "accountId": "[613bd50411d5e10071d3c6e3, 619574ff2278e7006b648986, 61afa232977c5b0072741ca8]" }]
Any suggestions on how to copy the insight multi-user field to an issue multi-user field?
Found documentation with this exact example (see example 3):
https://confluence.atlassian.com/jirakb/auto-populate-approvers-from-insight-objects-1072474097.html
Tested it and it worked perfectly. I did not even have to create a lookupObjects field first, I could use the existing Insight Object custom field directly. The trick was to use the 'flatten' method for the multi-user field.
In my example, the Edit Issue rule looked like this (the custom field containing the insight object is called 'Main System' in this example.
{
"fields": {
"Support Group Members": {{Main System."Support Team Level 1".flatten.asJsonObjectArray("id")}}
}
}
many thanks for that link. It took me hours to find this...
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.