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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,552,201
Community Members
 
Community Events
184
Community Groups

Using automation, how do I lookup an Asset attribute value use that to set a field on the issue?

We use Jira Asset Management and have a [Unit] object with an Attribute that we have configured with the "Organization".  When requestors submit a new ticket, the [Unit] Asset field is on the request intake.  I want to use automation to have Jira lookup the Organization attribute in the Asset record for the Unit and then set the Organization on the Issue to that value.  

I see in the automation that I can set a value on the Asset but can't seem to find where I would lookup from the Asset and subsequently set a field value on the Issue itself.  Thoughts? s

2 answers

1 accepted

2 votes
Answer accepted
Frederic Chartrand
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2023

Hi @Marcus Lopez 

First, you need to create another custom field for where you want to store the info about Organization if it's not already done.

After that, you can use the Lookup objects action in Automation and the request would be : objectType = Unit and Key = {{issue.unit}} (unit being you're customfield here)

Finally, you add another action Edit issue, you choose your field and you add the info by using the smart value {{lookupObjects.Organization}}

 

If the Organization attribute refers to another Assets object, I'd create an Assets custom field to store the Organization. If not you can create a simple text field.

 

Hope this helps.

Thank you!  I think I'm close.  I put a 'log' step in there to verify it's pulling the Attribute from the Object, and it is.  But then I get a parsing error.  First image is from the automation log - shows "Albuquerque" which is the Unit Name ... and this is what is output to the log:  {{lookupObjects.Organization (Jira)}}

Then I try to edit the issue with the second image below, which is giving the parsing error.  Not sure what I'm doing wrong.  

image.pngimage.png

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 19, 2023

Your JSON that you are using is missing "" around the smart value, try this:

{

    "fields": {

       "organizations": {{lookupObjects.Organization (Jira)}}"

    }

}

Okay, getting closer.   It doesn't like the text value that's in that attribute.  I wants a numeric.  Do I have to change the data type for the field or is there some magic I can do?  image.png

And this is what the script looks like right now - I had to surround it in brackets as it is expecting an array: 

{
"fields": {
"Organizations": ["{{lookupObjects.Organization (Jira)}}"]
}
}

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 19, 2023

Okay, so you need to map your Asset org to the number that JSM is using for the Organization field (much similar to user picker fields that takes the user's Atlassian ID). If you go to Customers in your JSM project and click on an org you will see that the URL ends with at number (.../jira/servicedesk/projects/SIT/organization/2), that is what the field is expecting. So you could add that number as an attribute on your organization in Assets and then get it using object reference like this:

{{lookupObjects.Organization (Jira).(attribute name)}}

Thank you!!  I’m cooking… 

Because Jira Automation was expecting a number, I think the double quotes were screwing things up (meaning, I think I needed to convert the text back to integer somehow), but the workaround for that was creating an attribute name with no spaces.  I’m also going to change the value of the attribute from the name of the Unit to the internal Org ID as you noted.  Thanks for the quick help and guidance.  

Like Mikael Sandberg likes this
2 votes
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 19, 2023

It should be pretty straight forward, all you have do is add the lookup object component and set it up to search your object schema and then use the selected unit to find the object. Then you can use {{lookupObjects.Organization}} to set Organization.

Something like this:

Screenshot 2023-05-19 at 11.10.19 AM.png

In this case I am looking up departments based on what was selected on the form and then get attributes from that object to set the approvers.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events