Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner Jira Asset object attribute update with list of objects

Margo Martis June 15, 2023

Hello, there!

I have example code:

ArrayList<String> Tootaja = new ArrayList<String>();
Tootaja.add("HUMAN-1")
Tootaja.add("HUMAN-2")
System.out.println(Tootaja)
String test = ["value" : Tootaja[0] ], ["value": Tootaja[1] ],



HttpResponse<JsonNode> addValue = Unirest.put("https://api.atlassian.com/jsm/insight/workspace/${WorkspaceID}/v1/object/${ArvutiID}")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.basicAuth("xxxxx", "xxxxxx")
.body([
attributes: [
[
objectTypeAttributeId: 1901, 
objectAttributeValues:
[
["value" : Tootaja[0] ], ["value": Tootaja[1] ],
]
]
]
]).asJson()

Is it possible to add objects to objectlist and then add objectlist to objectAttributeValues
somehow with scriptrunner?

For example i have 2 people using an asset. I want to read those objects and add specific one object to the list and then update the asset attribute value. Do you have some suggestions to solve it. 

I know one example is to hold objects in Jira field and then update, but looking for solution where i dont have to make extra field for it. 

https://confluence.atlassian.com/jirakb/append-list-of-objects-to-a-reference-assets-object-attribute-using-automation-1141483722.html 


Thanks in advance 
Margo

1 answer

0 votes
Seoofy August 12, 2025

Hello @Margo Martis

I have create a LinkedIn post proving a solution for your scenario. You've probably sorted it out in the mean time, if not feel free to read my post https://www.linkedin.com/posts/activity-7360586856859680768-45rp?utm_source=share&utm_medium=member_desktop&rcm=ACoAAANdqw0B5fFI0ESmORo1jyernbkozUK6qWg

I hope it helps.

Best,

Daniella

Seoofy

 

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events