Lookup objects syntax
Asked by Wong:

I have the following query in the lookup objects in automation:

objecttype = "Contact" and "Team" = {{"vAssignedTeam"}}

that works when the variable vAssignedTeam does not have a space in the name. When the team has a space in the name, it does not return anything, can someone verify that my syntax is correct?


Answers:
author: Bill Sheboy
body: Hi [@WB](/t5/user/viewprofilepage/user-id/3537536)

If that is a variable, please try putting the quotation marks around the smart value instead:

objecttype = "Contact" and "Team" = "{{vAssignedTeam}}"

Kind regards,  
Bill

comments: author: Wong
body: Hi [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) ,

Thanks for the suggestion, I gave it a try and still does not work.


author: Bill Sheboy
body: Would you please post images of your complete rule and the audit log details showing the execution? That may provide context for what you are seeing. Thanks!


author: Wong
body: I am hosted so can not export the log. I split out the automation rule that is not working into a this simple manually triggered automation rule:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/231918i73AC6E5005B748B2/image-size/large?v=v2&px=999 "image.png")

Here's the Query:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/231919i8BA9FA8B34339F82/image-size/large?v=v2&px=999 "image.png")

Here's the log:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/231921i9E135154765E5223/image-size/large?v=v2&px=999 "image.png")

Here's the comment, you can see that the variable printed out "Network Services" while the lookup object returns nothing.

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/231920i90C9C099461AEB8D/image-size/large?v=v2&px=999 "image.png")

Here's the object it should've returned from the Asset schema:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/231923iBBC04CA42967A5EA/image-size/large?v=v2&px=999 "image.png")


author: Bill Sheboy
body: Just to confirm, you are using Jira Cloud, correct?

Would you please show your Create Variable component in the rule? That may explain what is happening with the lookup.

Next, I wonder: smart values are case-sensitive and I suspect the JSM objects are as well. Perhaps change the lookup query to this:

```
objectType = "Team" AND "Name" = "{{vAssignedTeam}}"
```

And, after the lookup would you please write these two things to the audit log:

```
Number of objects found: {{lookupObjects.size|0}}
List of the object names: {{#lookupObjects}}{{Name}}{{^last}}, {{/}}{{/}}
```

The second one will list just the Names of any objects found, with a comma separator.


author: Raphael Lopes
body: Does it only return 100?


author: Wong
body: Yes, we are cloud. Using your suggestion to log the number of found, I was able to resolve the isssue. It appeared that I just need to add a " " to my variable statement. So, my original variable statement was: {{description.substringBetween("Team:",";")}}.

This was changed to: {{description.substringBetween("Team: ",";")}}, with a space after Team:

This fixed my issue. Thanks for your help in suggesting to log the object found.