Use a list of Asset values in an automation

Alex Ziegltrum April 19, 2023

Hi all,

in assets I have a scheme "configuration". The records in this scheme have an attribute "ID".

In an automation, I want to compare the Request Type ID of an issue, if it is contained in one of the records "ID" field in the "configuration" asset scheme.

If the issue request type ID matches to one of the items in "configuration" scheme, a custom field of the issue must be filled with a given value.

If the request type ID is not within the "configuration" asset scheme, the custom field must be filled with another given value.

Is it possible to query that?

Cheers, Alex

1 answer

1 accepted

0 votes
Answer accepted
Tessa Tuteleers
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 19, 2023

Hi @Alex Ziegltrum , 

your request consists of 2 parts: 

  1. You need to find the request type ID of your issues, I assume we are talking about the Customer request type? 
    You can get a lot of different smart values about your issues to use them. 
    You could look in the documentation to find your smart value here, but not everything is listed. 
    Luckily you can look up your own smart value using a JSON view of the issue. IT is documented here.
    To debug if you can get the id, add a "log" action and log the smart value to the automation rule audit log.
  2. Second, you need to query for objects matching that id value in a specific attribute. You can use a lookup objects action for that.  (and again, log the result if it does not work as expected)
    attributeName = {{issue.Request Type.requestType.id}}

    You can now create an if/else condition using that result to get different actions for the different outcomes. The condition being that the amount of objects returned must be more that 0 
    {{lookupObjects.size}} greater than 0

Hope this helps! 

If you can't figure it out, let me know! 

- Tessa

Alex Ziegltrum April 19, 2023

Hey @Tessa Tuteleers

thank you so much for your proposal. I don't know if it is a good approach, but meanwhile I managed the following:

I lookup in Assets where my values to compare with are:

image.png

With that I can compare the ID of my issue (it is something like 11.0 hence the round) wiht the values from Assets. If the value is found I edit a custom field.

image.png

If not, I check in an else-if block, if it is another value. If the value is found, I edit a custom field.

image.png

If none of the above matches, I edit the custom field in a last Else block to a certain value.

image.png

That works so far!

Right now, I am troubling with the trigger, that should go off, if there is a change of the request type or the request type ID.

When I do the change of the request type (not the issue type) in the ticket dialogue, the dialogue changes, but the ID does not change. I checked it by clicking on "configure". In the URL I still see the ID of the ticket as it was before, but in the ticket, the name of the request type has already changed.

image.png

Due to that, the trigger does not recognize the change and does not update the fields as it should.

Have you got an idea, what I should check? I am not excluding, that I still have a misunderstanding of request types and the ID that goes with it.

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

Hi @Alex Ziegltrum , 

If you use the trigger "Field value change" for "Request type", it should trigger just fine (and it gets the new ID, I tested real quick).

If it doesn't work, screenshot you entire rule, so we can help debug :) 
Specifically how you created the smart value that you are rounding up, all my request type ID's seem to be integers, so it's weird that you don't have that

- Tessa

Alex Ziegltrum April 19, 2023

Hi @Tessa Tuteleers

indeed :D I used the trigger as you described it. I am having kind of a timing problem, as it looks to me.

The trigger recognizes the change of the "Request type" very well and superfast. Though the Request Type ID itself seems to be changed later on. Therefore in my automation, I see the new name of the Request Type, but the Request Type ID as it was before the change.

And when checking for changes on "Request Type ID" in the trigger rule, it does not recognize it at all.

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

Hmm, in that case, have your trigger on the change of the Request type, and then do a "re-fetch issue data" action before anything else. 

If it doesn't work, screenshot our rule so we can debug :)

- Tessa

Alex Ziegltrum April 19, 2023

Hey @Tessa Tuteleers 

with your help, I think I could fiddle out a solution for my use-case 🥳

First, I want to share some findings with you.

It seems, my "Request Type ID" custom field is configured as number, is it usually like that or how is it configured then?

image.png

As I used your suggestion from above {{issue.Request Type.requestType.Id}}, this gives me an integer-like value. I guess, you meant that initially in this thread, instead of a custom field "Request Type ID" of any kind?

Some automations fill and update that custom field, which explains the delay in the automation, which it is about in this thread.

The solution that works for our use-case looks as follows:

image.pngimage.pngimage.pngimage.png

The trick is the first step to put the value from {{issue.Request Type.requestType.Id}} in the custom field "Request Type ID" and refetch data. With this I do not run into the timing problem. From then on, I can work as desired with the (integer?) value for the comparisons and updating the other custom field.

Thanks a lot @Tessa Tuteleers for your kind and patient support.

Cheers, Alex

Tessa Tuteleers
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 20, 2023

Hi @Alex

I'm not sure why you need the custom field "Request Type ID", as you don't need if for this to work, but if it is for some other requirement, great! 

Glad it worked out! 

- Tessa

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