{{lookupObjects.size}} in automation rule
Asked by Maria Plavin:

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


Answers:
author: Kai Becker
body: Hi [@Maria Plavin](/t5/user/viewprofilepage/user-id/5474637)

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

comments: author: Maria Plavin
body: 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.


author: Kai Becker
body: Hi [@Maria Plavin](/t5/user/viewprofilepage/user-id/5474637)

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?


author: Maria Plavin
body: Hi [@Kai Becker](/t5/user/viewprofilepage/user-id/1178079)

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](https://community.atlassian.com/t5/image/serverpage/image-id/318291i7DC2CBE986CEC780/image-size/large?v=v2&px=999 "jira automation.png")

Code in the message box:

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

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


author: Kai Becker
body: Hi [@Maria Plavin](/t5/user/viewprofilepage/user-id/5474637)

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.


Tags: data-center

jira-service-management

jira-service-management-data-center