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

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

Marcus Lopez May 19, 2023

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

4 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.

Marcus Lopez May 19, 2023

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)}}"

    }

}

Like Aaron P. likes this
Marcus Lopez May 19, 2023

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

Marcus Lopez May 19, 2023

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)}}

Marcus Lopez May 19, 2023

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.

Anne Warmer
Contributor
June 3, 2024

I'd like to use this in Jira Business Project. Why is the functionality only available in JSM? 

Do you know if there are any plans to make it available in Jira (fka Software or Workmanagement) ?

 

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.
June 3, 2024

Hi @Anne Warmer,

This should be its own question, but the main reason is that Assets is a functionality that is par of JSM. You are still able to use an assets field in Jira, but in order to have access to it you need to have JSM access.

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