Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

GroovyScript: Get User located in Custom Field within an issue.


Hi Everyone!

     In my organization, our Jira setup has a customField_12000 which is pointed to an object labeled "Affected Objects", there can be multiple Affected Objects", Within these objects is a Contact(s) field with multiple users inside. Does anyone know an easy way to fill this value?

Taking a step back, the goal is really to target an "Affected Object" by itself and not specifically from a linked issue, then to show who is the primary contact for that object through a rest call if possible.

It seems alot of examples help me pull the Affected Object itself but not the contact within?

I messed with the GroovyScript to see if I could get it to load anything and I was able to successfully reflect the name of the affectedobject within the field but not the contact located within that specific object.

Thanks for any Pointers!!

[My failed attempts]

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.Issue;
//ComponentAccessor.getCustomFieldManager().getCustomFieldObject(12000); = "Affected Object(s)"
def value = issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObject(12000)); // Change ID to the correct one

CustomField myCF = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(12000)
def objectBean = myCF.getValue(issue)[0]

/* If an insight custom field has an object called "Microsoft" it will fail */
if (value != null && "Microsoft".equals(value[0].getName())) {
return "This is not a valid vendor!";
//return value[0].getAt(0).name
return objectFacade.loadObjectAttributeBean(value[0].getId(), 12000).getObjectAttributeValueBeans()[0].getValue()
return value[0].toString()
return value[0].getId()
return value[0].getLabel()
return value[0].getClass()
return value[0].getName()


The code above helps return some minor details of the affect object selected at index [0] but what am I missing to get the underlaying attribute?

1 answer

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events