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

{{lookupObjects.size}} in automation rule

Maria Plavin April 12, 2024
I can´t get "{{lookupObjects.size}}" to work in an automation rule in Asset Management to work.
I would like to email the number of found assets in the AQL query that I use.
I would also use "{{lookupObjects.size}} > 0" as a condition in the rule to get a list of found assets in the same email rather than getting one email per asset.
 
And also I needed to insert a $ first and then remove one of the { }, so in my case it looks like:
${#lookupObjects}
- ${Name}
 
So, I have tried with "${lookupObjects.size}" in the email action part, but it doesn´t print out the size (or the count).

1 answer

0 votes
Kai Becker
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 12, 2024

Hi @Maria Plavin 

welcome to the community and thank you for your question.
It looks like you mixed things up a little bit. 

To display the size, you should use

 {{lookupObjects.size}}

To geht the content of each object (e.g. name) you could iterate over the list (thats where the # sign is used for):

{{#lookupObjects}}
   {{Name}}
{{/}}

Hope this helps 

Maria Plavin April 14, 2024

Hi and thank you!

I have tried the code you´re suggesting, but it doesn´t work - Jira interprets it as raw text and not as variables. I have to add the $-sign, so the following works for me:
${#lookupObjects}
- ${Name}

I don´t know if it´s because we´re running Jira as a data center and not in the cloud?

As for printing out the number of lookupObjects, neither {{lookupObjects.size}} nor ${lookupObjects.size} works for me. It´s like the automation is unable to interpret ".size". I have also tried ".count", but that´s not working either.

Kai Becker
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 15, 2024

Hi @Maria Plavin 

sorry for the misleading answer. I'm not quite sure if I got you right. The code you wrote is for cloud, but you selected that your environment is DC/Server. Could you clear things up and maybe post a screenshot on the Automation rule configuration?

Maria Plavin April 15, 2024

Hi @Kai Becker

Thanks´ for your patience!

Our environment is DC/Server (at least as far as I know - it´s the group's IT that manages it and I have been told that it´s an on-premise environment).

Attaching a screenshot of the automation rule. Not all the text in the message box is visible, so I´ve pasted it further below.

jira automation.png

Code in the message box:

Number of products to control: ${lookupObjects.size}

${#lookupObjects}
- ${Name}, next day for control: ${Test med datum}

Kai Becker
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 15, 2024

Hi @Maria Plavin 

no worries. I'm sorry, that I did not read everything in detail. As far as I know, there is no such thing like lookupObjects in DC. This is probably taken from the cloud documentation.

The assets "smart values" work a little bit different on DC. You will probably need to take a look at this page: https://confluence.atlassian.com/servicemanagementserver/advanced-placeholders-1044784599.html

I'm not quite sure if it is possible to extract the data you need to have in an easy way.

Like Maria Plavin likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events