I have an automation rule looks up issues via JQL, sends an email, and then transitions those issues to a status. When issues are returned from the JQL, the automation runs perfectly. However, when there are no issues, the automation runs like I want it to but returns an error (and thus sends me an error email). From what I can tell, I cannot wrap the branch around an IF condition {{lookupIssues}} is not empty to prevent the error. For my own awareness, I do not want to disable error notifications when this rule fails in case there are other issues at some point. Is there some way that I can adjust this logic to not throw errors when no issues are returned in the lookupIssues for the branch? This is a JWM project in case that makes a difference.
My logic....
Scheduled at 2am
Then: Lookup issues - search for issues using JQL
project = XXXX and type = "Sub-Task" and status = XXXXX ORDER BY due ASC
If: matches
{{lookupIssues}} does not equal Empty
Then: Send email
Else
Then: Add value to the audit log.
no email sent
BRANCH
For: JQL
key in ( {{lookupIssues}} )
Then: Add value to the audit log.
If status equals
My Status
Then: Transition the issue to
My Next Status
............
Audit Log
Lookup issues
A search during custom value definition found no issues.
Else block
Else block executed
Log action
Log
No email sent
Branch rule / related issues
Error searching for related issues. This is most likely because the following issues don't have a related issue of the type you specified. Try narrowing your search to only include issues that contain links to related issues:
NO ISSUE: "(key in ( )) AND (project in (14232))" - Error in JQL Query: Expecting either a value, list or function but got ')'. You must surround ')' in quotation marks to use it as a value. (line 1, character 12)
Is there any way that I can adjust this logic to not throw errors when no issues are found to transition?
Hello @jbrowne
Is there a reason that you are using a Lookup Issues action within your scheduled rule rather than putting that JQL directly into the Scheduled trigger? Is that related to sending just one email for the entire result set, while also being about to separately execute the transition against each issue?
I want to send one email that includes all issues returned in the JQL instead of one email per issue and then afterwards I want to transition each issue.
I split the run into two and have the results I want.
The first automation is scheduled with no JQL in the trigger, it uses lookup issues and sends one 'batch' email for all issues returned.
The second automation is schedule with JQL. It transitions the issue(s) without using lookup issues. If there are no issues to transition (no issues returned in the JQL) then it does not send an error email.
Thank you @Trudy Claspill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.