Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Copy multi-user field from Insight object to multi-user field in jira issue

Pieter Wouter Hartog
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.
July 12, 2022

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?

1 answer

1 accepted

2 votes
Answer accepted
Pieter Wouter Hartog
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.
July 21, 2022

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")}}
}
}
Christian Schneider
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.
June 7, 2024

many thanks for that link. It took me hours to find this...

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