Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Community showcase
Published in Confluence Cloud

🎨 Add some visual life to your templates

Hi Atlassian Community, My name is Avni Barman, and I am a Product Manager on the Confluence Cloud team. Based on feedback from you, we are giving admins more power to create templates that a...

133 views 1 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you