Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Get Null values from custom fields that are populated with user ID in scriptrunner

When I use the following script that I put together I am getting null values for the ApproversCFval and the and the ApprovalsCFval. It does populate the customfield_10557 with null-null.  the approversCFval should be a user id that i have confirmed is already populated with a user id value. 


Is this related to the customfield data type or how the script is written?

Is there a different way to pull a value from a custom field that is a user picker type? 

Also the ApprovalsCFval will be pulling from a custom field that has a approvals data type and that is also returning a Null value.


def projectKey = issue.fields.project.key
def issueKey = issue.key

// Get the issue object
def customFields = get("/rest/api/2/field")
.findAll { (it as Map).custom } as List<Map>

def approversCFId = customFields.find { == 'Approvers' }?.id"${approversCFId}")
def approversCFval = customFields.find { == 'Approvers' }?.val"${approversCFval}")

def approvalsCFId = customFields.find { == 'Approvals' }?.id"${approvalsCFId}")
def approvalsCFval = customFields.find { == 'Approvals' }?.val"${approvalsCFval}")

def PostToField = customFields.find { == 'AActionVAL' }?.val"${PostToField}")

def resp = put("/rest/api/2/issue/${issue.key}")
.header('Content-Type', 'application/json')
fields: [
"customfield_10557": "${approversCFval}" + "-" + "${approvalsCFval}"


Anyone have any insight into this?


Thanks in advance


0 answers

Suggest an answer

Log in or Sign up to answer
Site Admin

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you