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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


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

Updating a custom field with an Insight Object attribute value during Issue Update event


Hello all,

I am trying to set a custom listener up that will take attribute values of an Insight Object and populate the custom fields when an issue is updated, just like the post function. I've found a few examples out there, but have basically drawn a blank here. 


I started with this script from Riada:

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.event.type.EventDispatchOption;
import com.atlassian.jira.issue.context.IssueContextImpl;
import com.atlassian.jira.issue.fields.config.FieldConfig;  

/* Custom field for the organisation */
CustomField organisationCF = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(10000);         
if (organisationCF == null || organisationCF.getValue(issue) == null) {    
return false;

/* Get Insight Object Facade from plugin accessor */
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("");  
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass);   

Class customFieldFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("");  
def customFieldFacade = ComponentAccessor.getOSGiComponentInstanceOfType(customFieldFacadeClass); 

IssueContextImpl issueContext = new IssueContextImpl(issue.getProjectObject(), issue.getIssueType());
FieldConfig fieldConfig = organisationCF.getRelevantConfig(issueContext); 

def objectTypeAttributeName = null;
//objectTypeAttributeName = "JIRA User"  // Set an object type attribute name if you want to restrict the user fetch on just that type attribute. 

def objects = customFieldFacade.findUserObjectsByNormalCustomField(                                        
fieldConfig.getId(), currentUser,                                        

if (objects.isEmpty()) {    
return false;

def organisationTypeAttributeId = 123// The object type attribute id of the organisation attribute for the user object type.
def organisationObjectAttributeBean = objectFacade.loadObjectAttributeBean(objects[0].getId(), organisationTypeAttributeId);

if (organisationObjectAttributeBean == null) {    
return false;

MutableIssue mi = (MutableIssue) issue;
mi.setCustomFieldValue(organisationCF, [objectFacade.loadObjectBean(organisationObjectAttributeBean.getObjectAttributeValueBeans()[0].getReferencedObjectBeanId())]);
ComponentAccessor.getIssueManager().updateIssue(currentUser, mi, EventDispatchOption.DO_NOT_DISPATCH, false); 
/* We are done! */
return true;

All I want to do is take the attribute values and populate the custom fields. 


Any help is greatly appreciated. 

1 answer


Did you come right with this ?

I am trying to do something similar.

I have "reporter details" object in Insights. 

Attributes Department and Business Unit.


I want to update Jira custom fields "Business Unit" and "Department" on all tickets to the attributes above.

I would like this to do this with Automation, so that any changes are taken into account.

I can do it in the workflow on new issues, but need to update these fields for all pre-existing.

Help Please

Unfortunately, I have not been successful. I'm still working on it, but keep getting pulled away for other priorities. I have a scripting expert on my team now and hope that he may be able to work some magic. I'll keep you updated with our progress.

Like # people like this

Hallo Thomas,

any news?





Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events