How do I copy a multi-user picker field to watcher field using Script Runner plugin on jira-cloud?

Alok Singh August 10, 2017
Hi, I am trying to copy the values in the multi-user picker field to watcher field in JIRA cloud but the value I am getting is always null. Here is the implementation:

def input1CfId = 'New Watchers'
def outputCfId = 'Watchers'

logger.info("${input1CfId}")
logger.info("${outputCfId}")

def customFieldUsers= get('/rest/api/2/issue/' + issue.key).
asObject(Map).body['fields']['New Watchers']

def input1 = issue.fields[input1CfId]
def input2 = issue.fields[outputCfId]

logger.info("${customFieldUsers}")
logger.info("${input2}")

def output = input1
logger.info("${output}")

if (output == (issue.fields[outputCfId])) {
logger.info("already been updated")
return
}

put("/rest/api/2/issue/${issue.key}/watchers")
//.queryString("overrideScreenSecurity", Boolean.TRUE)
.body([
"watchers" : [
"name" : output
],
])
.asString()

 

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events