Snippets

Adaptavist Example of how to set the value of an Asset / Insight List via ScriptRunner's Run Script Post-Function

Created by Ram Kumar Aravindakshan last modified Kristian Walker
/*
 * All right, title and interest in this code snippet shall remain the exclusive intellectual property of Adaptavist Group Ltd and its affiliates. Customers with a valid ScriptRunner
 * license shall be granted a  non-exclusive, non-transferable, freely revocable right to use this code snippet only within their own instance of Atlassian products. This licensing notice cannot be removed
 * or amended and must be included in any circumstances where the code snippet is shared by You or a third party."
*/

def issueKey = issue.key
def workspaceId = '<WORKSPACE_ID>' 
def newObjectId = '<OBJECT_ID>'

def updateMap = ['workspaceId': workspaceId,'id': "${workspaceId}:${newObjectId}", 'objectId': newObjectId]

put("/rest/api/2/issue/${issueKey}")
    .header('Content-Type', 'application/json')
    .body([ 'update': [ '<ASSET_CUSTOM_FIELD_ID>' : [ [ 'set': [ updateMap ] ] ] ] ]).asString().body

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.