How to set a user picker cf?

Louisa Pabst August 6, 2015

Hi,

i want to set the user picker field "customer" in a subtask. The subtask was created in a transition of the parentissue. The value of the user picker "customer" is set in the maintask during the same transition and I want to copy this value to the cf in  the subtask. I've tried the following code:

def trans = transientVars["issue"]
def valueCustomer = trans.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("customer"))
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Customer'}
issue.setCustomFieldValue(cf, valueCustomer)

 

Best regards,

Louisa

1 answer

0 votes
JamieA
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.
August 6, 2015

First of all you're getting "customer", then later "Customer". It should be throwing an NPE with your code, check the logs.

Louisa Pabst August 6, 2015

Thanks for your fast response! I'm sorry that was a stupid mistake! however, it still does not work :/

JamieA
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.
August 6, 2015

Did you check the logs?

Suggest an answer

Log in or Sign up to answer