Slack Messages includes issues not included in lookup
Asked by Andrew Hickey:

Trying to create an automation that sends issues still in review for a specific Jira Board.

<br />

![Screen Shot 2021-09-05 at 1.32.14 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/159009i7F3375D3C22F5041/image-dimensions/206x359?v=v2 "Screen Shot 2021-09-05 at 1.32.14 PM.png")

The challenge is that the Slack Message includes additional issues that are not included in the Lookup Issues.

For example, this SQL finds 4 issues for this CS board (see image). However, the Slack message in the channel shows 33 issues (includes issues in review rom other projects). Why are other projects included in the slack message?

![Screen Shot 2021-09-05 at 1.32.46 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/159010i222BA41FD2B3A705/image-dimensions/333x115?v=v2 "Screen Shot 2021-09-05 at 1.32.46 PM.png")

Slack message field:

Currently there are {{lookupIssues.size}} tickets in review,

{{#lookupIssues}}  
:white_medium_small_square: \<{{url}} \| {{project.name}} - {{key}} - {{assignee.displayName}} - {{summary}}\>  
{{/}}


Answers:
author: Jack Brickey
body: One thing that pops out at me immediately is I believe your JQL may be flawed? As written that JQL will return issues outside of your CS project since you have the OR statement outside of any parentheses. Maybe your JQL should look like this?

project = CS and status in ("in review", "in test")

comments: author: Andrew Hickey
body: Thanks, Jack! The JQL seems to come back with 4 issues which is the number I expect.   

It doesn't seem to like this JQL? Maybe because of the "in" word is part of the status

![Screen Shot 2021-09-05 at 4.12.18 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/159012i79A2AFD8ACF59450/image-size/large?v=v2&px=999 "Screen Shot 2021-09-05 at 4.12.18 PM.png")


author: Curt Holley
body: The JQL looks right. By having those multi-word statuses in quotations should take care of the confusion it is complaining about.


author: Jack Brickey
body: [@Andrew Hickey](/t5/user/viewprofilepage/user-id/4085923) , a couple of comments...

* as Curt indicated the JQL looks correct from what I can see
* The odd thing is that The error is saying there is an error at character 59. Well there's only 51 characters in that check you well.
* If you paste that JQL directly in the advanced search does it work? Maybe you've already tried that as indicated by your text above - *The JQL seems to come back with 4 issues which is the number I expect.*
* Is this a project rule or global rule? If project then remove the "project = CS" and simply use **Status in ("in review", "in** test"). Tip, get your JQL working in the advanced search first then copy and paste it directly into your rule.


author: Andrew Hickey
body: Thanks [@Jack Brickey](/t5/user/viewprofilepage/user-id/853369) and [@Curt Holley](/t5/user/viewprofilepage/user-id/3527535) !   

1. This is a project rule. I included the "project = CS" just in case it was helpful.

![Screen Shot 2021-09-05 at 4.55.58 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/159013i22EB2820DCD69B91/image-dimensions/163x226?v=v2 "Screen Shot 2021-09-05 at 4.55.58 PM.png")

2. Excluded the "project = CS" but still receive the same error :/

![Screen Shot 2021-09-05 at 4.57.03 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/159014i95A1006808A08D03/image-dimensions/343x195?v=v2 "Screen Shot 2021-09-05 at 4.57.03 PM.png")

3. Regardless, my previous JQL receives 4 issues found, but my slack message shows 33 issues.

![Screen Shot 2021-09-05 at 5.03.44 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/159018i8ED3D7AB3ACBB3C4/image-dimensions/309x133?v=v2 "Screen Shot 2021-09-05 at 5.03.44 PM.png")

![Screen Shot 2021-09-05 at 5.00.44 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/159017iBB1C2051AD0A5303/image-dimensions/234x190?v=v2 "Screen Shot 2021-09-05 at 5.00.44 PM.png")

![Screen Shot 2021-09-05 at 5.04.54 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/159019i9B1534FCA2B8B33D/image-size/large?v=v2&px=999 "Screen Shot 2021-09-05 at 5.04.54 PM.png")

4. If I remove the "Project = CS" from my initial JQL, then my slack message shows 47 tickets (despite this being a project rule)

![Screen Shot 2021-09-05 at 5.00.00 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/159015i62408CF7E8BB1F5F/image-dimensions/331x143?v=v2 "Screen Shot 2021-09-05 at 5.00.00 PM.png")

![Screen Shot 2021-09-05 at 5.00.44 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/159017iBB1C2051AD0A5303/image-dimensions/234x190?v=v2 "Screen Shot 2021-09-05 at 5.00.44 PM.png")

![Screen Shot 2021-09-05 at 5.02.51 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/159016iDE56F60D7EA0EF50/image-size/large?v=v2&px=999 "Screen Shot 2021-09-05 at 5.02.51 PM.png")


author: Curt Holley
body: Put the Project = CS back into your lookup issues action.

and

What is in your schedule? does it have any JQL configuration?

If not, then add your same JQL there. That way only those 4 issues are part of the rule from the get go.

Of course all of this does require getting your JQL to work. But totally agree with [@Jack Brickey](/t5/user/viewprofilepage/user-id/853369) . Get it working in Advanced Search, copy into the rule....and it should be fine.


author: Andrew Hickey
body: Thank you [@Curt Holley](/t5/user/viewprofilepage/user-id/3527535) and [@Jack Brickey](/t5/user/viewprofilepage/user-id/853369) !   

The advanced search helped a lot. Just copied into the rule like you suggested :)

*for anyone experiencing a similar challenge, I updated my JQL as listed below after testing with the Advanced Search*

```
(project in (10017)) AND (Project = CS AND status = "in review" or (status = "in test"))
```


author: Curt Holley
body: That is an interesting JQL.

Why the (project in (10017)) part? *as surely that has to be the CS project or the query would not return anything due to the AND statement.*

I'm also frustrated by you not being able to get away with:

```
Project = CS AND status in ("in review", "in test")
```

as it really should work.

**For the record;** You are using Jira Cloud...yeah? or......?


author: Andrew Hickey
body: Agreed ... not sure why the

```
(project in (10017)) AND ...
```

resolved the issue.

Yes! Jira Cloud.