Forums

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

Jira/JSM DC 9.12.x set issue summary to name of Object in Asset Custom field

Trudy Claspill
Community Champion
May 14, 2025

I'm working with Jira Data Center 9.12.x.

I have created Asset objects. I have added an Asset Custom Field to my issue with the field configured to allow selection of only one object from the list.

I want to set the Summary field of the issue to the Name of the object. I know I can do this with an Automation Rule.

I'm trying to figure out if it can be done in a workflow post function.

The native Assets Post-Function appears to support copying asset data only to issue custom fields. It does not allow me to select the Summary field as the destination.

I have ScriptRunner, JWT, and JMWE.

With ScriptRunner I have tried to create a custom inline script to use with the Custom Script Post Function, but haven't found an example of code that has worked correctly for me to retrieve the Asset based on the information in the Asset Custom Field in the issue

I have tried this code:

def assetKey = issue.getCustomFieldValue("customfield_1234")
def assetObject= Assets.getByKey("${assetKey}")

I get back this error:

No object with key '[Name of object {object key)]' exists

I'm sure I have missed a piece of documentation or example that is readily available, but my Google searches so far have been unsuccessful.

1 answer

1 accepted

3 votes
Answer accepted
Björn Gullander Eficode
Community Champion
May 15, 2025

Hi Trudy, 

Asset custom fields are always stored as an array of objects - even when it is a single object field. What you need to do is to get the first object  and then get the object's name. (you already have the object so you don't need to get it with Assets.getByKey. 

Something like this: 

def issue = Issues.getByKey("ABC-233)
def asset = issue.getCustomFieldValue("Assetfield")
def assetName = "No asset found"
if (asset?.size()>0) //check that there is a value in the field
assetName = asset.first().label
return assetName
Trudy Claspill
Community Champion
May 15, 2025

Thank you, @Björn Gullander Eficode ! You've come to my rescue again.

Suggest an answer

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

Atlassian Community Events