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.ComponentAccessor
def customFieldManager = ComponentAccessor.customFieldManager
def customerCf = customFieldManager.getCustomFieldObject('customfield_11029')
def orgCf = customFieldManager.getCustomFieldObject('customfield_12012')
def orgValues = issue.getCustomFieldValue(orgCf) as List
if(!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}"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.