Hi all
I wanted to automatically add the organization name to the custom field, but I found that I couldn't get the specified name. Here's my code
The Organization field will store a list of CustomerOrganization objects.
You can combine the list (even if you only expect 1) as comma-separated string.
Here is your script, slightly modified:
import com.atlassian.jira.component.ComponentAccessordef customFieldManager = ComponentAccessor.customFieldManagerdef customerCf = customFieldManager.getCustomFieldObject('customfield_11029')def orgCf = customFieldManager.getCustomFieldObject('customfield_12012')def orgValues = issue.getCustomFieldValue(orgCf) as Listif(!orgValues) return null //exist the script if the org field is empty//Organization store a list. Even if in most case you only have one. We can join them with comma (and a space for human readability)issue.setCustomFieldValue( customerCf, orgValues.collect{it.name}.join(', '))
Hi @PD Sheehan
Thank you for your reply
I tried it as you suggested and met with a mistake:
No such property: name for class: java.lang.Object
it seems I'm not allowed to use "{it.name}"
It looks like you're new here. Sign in or register to get started.