Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Update Object Attribute Insight - Add NOT overwrite - Script advice

Hey there!

We are using Insight in our Jira Server instance to manage our enterprise applications. For each system (object) we've defined three separate object attributes (Guests, Users, Admins) that captures all users that have access to the system.


What we are trying to achieve is adding users to these Insight attributes when a Jira ticket is updated:


We've managed to leverage the script from the Insight docs - Update Object attribute

However naturally it is updating/overwriting any existing users captured in the Guests/Admins/Users object attribute. We want to add the user so we can get an accurate list of users for our systems.

Does anyone out there have any experience of what we are trying to achieve? How did you manage to ADD a user to existing object attributes without deleting what already exists in the object attributes field? Any script advice much appreciated!

Thank you!!

1 answer

Hi Daniel,

i had a very simular problem which i could not figure out by the documentation on my own, so i just asked the mindville support for some further examples. Helping writing groovy scripts is not part of the support but kindly they send me on example which helped me to solve my issue. I've asked and am allowed to share this here with you also.

My Request:

I want to add a second object to an object attribute on a existing object. How can i expand the current 'list'?

Explanation for the provided script:

In order to assign an Equipment Object ("front man asset) to a User, I reference the User Object on an Equipment Object (the Equipment will have an Attribute of the Type User, to reference User Object Type).

Once I assign an Equipment to a User, I would like the Equipment Object to be referenced back from the User Object.

A User may have already some Equipment Objects assigned, hence referenced.

In the attached script - Line 23, we get the attributeBean from the User Object.

We dhen check if there is an existing reference stored in the attribute:

If it is null (no reference is currently set in this attribute) - then the script will create a new reference and store it in the Attribute.

If a reference already exists, the script will add a new reference to the existing references (Values).


And here is the script:

import com.atlassian.jira.component.ComponentAccessor
//context: begin
// log, object, currentUser, issue, originalIssue (
def logger = (GroovyLogger) log
def objectBean = (ObjectBean) object
//context: end
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ObjectFacade.class)
def objectTypeAttributeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ObjectTypeAttributeFacade.class)
// Object is the Frontman Asset (4699) object type with the attribute 'Assignee' (20882) referencing the `User` (4702) object type
// `User` (4702) object type contain an attribute 'Assigned Equipment' (20958) that need to be set from this Frontman object
def assigneeAttributeBean = objectBean.objectAttributeBeans.find { objectAttributeBean ->
objectAttributeBean.objectTypeAttributeId == ASSIGNEE_OBJECT_TYPE_ATTRIBUTE_ID
assert assigneeAttributeBean != null, "Cannot find object type attribute assigneed `$ASSIGNEE_OBJECT_TYPE_ATTRIBUTE_ID`!"
def referencedUserId = assigneeAttributeBean.objectAttributeValueBeans.first().referencedObjectBeanId
def referencedUser = objectFacade.loadObjectBean(referencedUserId)
def equipmentAttributeBean = referencedUser.objectAttributeBeans.find { objectAttributeBean ->
objectAttributeBean.objectTypeAttributeId == EQUIPMENT_OBJECT_TYPE_ATTRIBUTE_ID
if (equipmentAttributeBean == null) {"Creating a new reference...")
def assignedEquipmentTypeAttribute = objectTypeAttributeFacade.loadObjectTypeAttributeBean(EQUIPMENT_OBJECT_TYPE_ATTRIBUTE_ID)
def newEquipmentAttributeBean = referencedUser.createObjectAttributeBean(assignedEquipmentTypeAttribute)
def equipmentValueBean = newEquipmentAttributeBean.createObjectAttributeValueBean()
} else {
def frontManReference = equipmentAttributeBean.objectAttributeValueBeans.find { objectAttributeValueBean ->
objectAttributeValueBean.referencedObjectBeanId ==
if (frontManReference == null) {"Creating a new reference (not found)")
def assignedEquipmentTypeAttribute = objectTypeAttributeFacade.loadObjectTypeAttributeBean(EQUIPMENT_OBJECT_TYPE_ATTRIBUTE_ID)
def existingEquipmentAttributeBean = equipmentAttributeBean.createMutable()
def equipmentValueBean = existingEquipmentAttributeBean.createObjectAttributeValueBean()
} else {"Equipment already set!")

Short flow:

  1. Get object
  2. Get object attribute
  3. If empty create new and set value
  4. else load value make it mutable and add(expand) a new value


Hope this helps


Suggest an answer

Log in or Sign up to answer

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