Used Builtin script listener to create sub-task and that part is working fine. Now trying to add a custom field, within automatically created sub-task. Name of the custom field to be CC_List and the value to be xyz@abc.com.
I followed Kostas' response at https://answers.atlassian.com/questions/196852/script-runner-create-subtask-built-in-script-postfunctionUsed the following call, to get the custom field object
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'CC_List'}
at this point, used "addCustomFieldValue" method and that did not work.any suggestions please ? Not sure how to proceed
tried the following (as available as an example)
If you just the right label, the right people will see this... that's generally more effective than sending me mail.
Using the built example worked for me:
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'TextFieldB'} issue.setCustomFieldValue(cf, 'my value')
but that's for a text field. What type of field is CC_List?
What versions are you using?
Jamie - thanks for looking into my request. We are using JIRA 6.1.7
CC_List is a custom field and type : UserPicker (multiple users).
Am I facing the problem, since it is not a text field ? thanks
Yes, the type of the field is not irrelevant here. You need to set it to a collection of User objects, or ApplicationUser, can't remember which.
I am running into a similar problem where I can't set the value either. My field is a single select list type, and oddly enough I can have the field inherit the value from the parent, but I can't seem to set it to a different value.
How/where would you specify the type of field? When I use the code below, the sub-task fails to create, however if I follow the template for copying the value from the parent, the sub-task creates and inherits the value properly.
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'CustomFieldName'} issue.setCustomFieldValue(cf, 'my value')
It looks like you're new here. Sign in or register to get started.