Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to access Asset data in an issue using smart variables in A4J

Dave Furlani January 22, 2024

We use Jira SM to lodge change management tickets when we do releases. We've recently added Assets and have populated the CMDB so we can now add Affected Services and Systems to these CMs.

What I'd like to do is use an issue transition trigger to fire an A4J rule that populates notification emails, both by listing the Affected Services and Systems (Name) data in the body of the email, and the addressees 

Our Object schema is called RAC

In the Schema tree I'm interested in the item/object we've named "System and Software", which is displayed in the issue as a field called "System". The attributes I want from that are "Name", "Custodian", "Primary Internal Contact"

If possible, I'd like to get from the Outbound references, the "Service", "Affected Service" and "Contact" data.

I've tried objects and lookupObjects, but that seems to pull only issue data, not the asset data from the issue

Has anyone been able to achieve what I'm trying to do (which seems like a fairly broadly applicable use case), and if so, what was the smart value syntax and/or actions you used?

1 answer

1 accepted

1 vote
Answer accepted
Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 22, 2024

Hi there!

This is what I tested:

Screenshot 2024-01-23 at 08.07.07.png

  • You first need to find the id of the Custom field containing the asset on the issue
  • Then use smartvalue:
    {{customfield_<id of customfield>}}
  • This will by default give you the asset key
  • By using dot-notation you can access the attributes on the asset (in this case the "Customer Facing" attribute)

That should fix your first requirement. For the second, that is a bit more complicated as you will have to lookup the linked assets via the lookupObjects. You could find those with an AQL like:

object HAVING inboundReferences(key IN ({{customfield_10129}}))

Then loop over those and do with those related assets what you would like to do. That's how I would approach this.

Hope this helps!

Dave Furlani January 23, 2024

Thanks @Jeroen Poismans 

That indeed helps. I was unable to see the customfield ID via the browser inspector, but the API call exposed it for me. I normally try that, so thanks for the reminder.

For those hunting the same - https://confluence.atlassian.com/jirakb/how-to-find-any-custom-field-s-ids-744522503.html 

The AQL syntax will come in handy too, because I've not played with that at all before.

Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 24, 2024

HI Dave,

In addition: If you go to the configuration page of the custom field, you will find the ID in the url ;-) 

Regards!

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