The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a ScriptRunner condition checking a custom field containing assets

Lily Driscoll
Contributor
October 25, 2024

I am trying to create a ScriptRunner condition within a workflow to determine if an issue's custom field contains X assets. I know multi select asset custom fields hold as an array. In script runner they are in a List, but I can figure out how to reference the objects as they are showing as below:

 

Screenshot 2024-10-25 093347.png

 

 

 

This is how is shows in the ticket and in XML:

Screenshot 2024-10-25 093439.pngScreenshot 2024-10-25 093502.png

I this code but it results in false:

 

 

issue.customfield_14962 .map(asset => asset.key) .includes("b2166d00-0d11-45d4-8aa2-6d3d154a18ab:367782")

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

2 votes
Answer accepted
Lily Driscoll
Contributor
October 25, 2024

I eventually found my answer, available fields are

{"id":"b2166d00-0d11-45d4-8aa2-6d3d154a18ab:367782","objectId":"367782","workspaceId":"b2166d00-0d11-45d4-8aa2-6d3d154a18ab"},{"id":"b2166d00-0d11-45d4-8aa2-6d3d154a18ab:367790","objectId":"367790","workspaceId":"b2166d00-0d11-45d4-8aa2-6d3d154a18ab"}

 

So to validate the code was

issue.customfield_14962.some(asset =>
    asset.id == "b2166d00-0d11-45d4-8aa2-6d3d154a18ab:367782"
)
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events