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.
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}")
}
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.