Automation: How to automatically fill object attribute with selected information (pre-existing list)

Jim Jam
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 24, 2025

I have some currently working code that creates an object (asset) in our Object Schema when a customer submits an Issue. It is to reduce some of the manual work of copying information across to our Object Schema by hand.

Scriptrunner-

{

    "objectTypeId": XXXXX,

    "Attribute 1": "{{issue.key.jsonEncode}}", [This works]

    "Attribute 2": "{{issue.name.jsonEncode}}", [This works]

    "Attribute Date": "{{issue.customfield_XXXXX.jiraDate}}", [This works]

    "Attribute List": "{{what do I put here?}} [only works if it's a Text field]

}

 

This has been transcribed so there may be some typos but essentially, I have been successful in Attribute 1, 2 and date fields but when it comes to Attribute List, I can't get the information to come across to the OBJ Schema attribute. it still just says "No Value".

The Attribute List is a multi-selectable dropdown which is referencing a pre-existing Object Schema. When a customer submits an issue with a selection in this field, I need to know how to put those same selections into the attribute on our Object Schema. 

I have tried some things like object lookup, value, ID etc but I may not be writing it correctly. I know the ID for the Object Schemas, I have all the custom field ID's required, I just need to know how to write it properly.

As an example, customer A will submit an issue and select Computer 1, Computer 2 and Computer 3 from the list of objects, these objects are from "List of Computers" Object Schema. I need those objects to transcribe across to the "Computers" attribute when the asset is automatically created. 

 

Cheers.

 

1 answer

0 votes
Pavel Kratky February 25, 2025

SO, you have an automation rule which creates Asset object via web request and to json body you put data from issue via smart values. Correct?

Are you using DataCenter(Server) or Cloud?

IMHO You should focus on how the payload needs look like (you can use log action to be able see result of smart values). And here is DOC to iterate list values from issue via smart value:
Jira smart values - lists | Automation for Jira Cloud and Data Center | Atlassian Documentation

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events