The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Assets - get user name for person in User attribute, for display in Issue

Trudy P Claspill
Community Champion
June 9, 2025

I'm working with Jira DC 9.12.x / JSD 5.12.x

I have created Asset objects that include an Attribute of type User. This field is set to a Jira user account. Note that the users are not defined as Asset Objects.

The goal is to display in an Issue Description field the name of a user specified in a User attribute in an asset object associated to the issue through a custom Asset Object field.

 

In an Asset Object I have an attribute of type User where I am selecting a Jira user account. In the UI it resolves to display the user's name and a link to their profile.
But in Automation Rules when I execute a ScriptRunner Lookup Asset action, the resulting object shows the value of the attribute as the user_key from the app_user table.
Smart values that work for User picker fields in issues, like reporter.displayName, don't work for User attributes in asset objects (i.e. lookupAsset.attributes.Owner.displayName)
I suspect I would have to use a Send Web Request action and access the REST API to get the user information. 
EDIT: I was thinking about trying to copy the User attribute  from the asset object into a User Picker field in the issue so I could get the user account info from the issue field. In Jira DC there is a native post function for Assets that includes an option for "update Jira issue custom field from Asset object attribute". However it doesn't support User attributes/User picker issue fields. There is also a option to set the issue Assignee based on a User attribute in an object, but the only issue field that is supported is Assignee - you can't select another User Picker issue field.
The client has ScriptRunner available, as well as JMWE, JSU, and JWT.
Is there any other solution?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

2 votes
Answer accepted
Björn Gullander Eficode
Community Champion
June 11, 2025

I didn't try doing it in an automation rule, but if you can use a script runner post function you should be able to use the following script :

 

//Get Asset field value

def fieldValue = issue.getCustomFieldValue("Input Approver")

if (!fieldValue || fieldValue.size() == 0){

log.info("No value set in field")

return

}

//Find user from the object's 'User' attribute

def assetObject = fieldValue.first() //Asset fields are always array of objects

def attrValue = assetObject.getAttributeValues("User")

if (!attrValue){

log.info("No user found in object attribute ${assetObject.objectKey}")

return

}

String userKey = attrValue.first().value

def displayName = Users.getByKey(userKey)?.displayName

log.warn("${issue.description}\nUser found: ${displayName}")

issue.update {

setDescription("${issue.description}\nUser found: ${displayName}")

}
Trudy P Claspill
Community Champion
June 11, 2025

Thank you again, @Björn Gullander Eficode 

I ended up with a very similar solution before seeing you response. I used the Execute a ScriptRunner Script action within the Automation Rule to do the same thing.

DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events