Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Flow action

sparkles
Tera Contributor

Hello,

 

I created flow to auto close any ticket opened 6 months ago, the flow run midnight. I need to send an email to the business with the list of all tickets that has been auto closed. the issue is the flow sending email even if action #3 didn't run.

I am not sure how to get action #4 to run only if there was close ticket from action #3. Below is my flow

 

 

sparkles_0-1768173628787.png

 

1 ACCEPTED SOLUTION

Chaitanya ILCR
Giga Patron

Hi @sparkles ,

 

you can use count data pill from the lookup records action 

if it's greater than 0 then send the email 

ChaitanyaILCR_1-1768176530229.png

 

ChaitanyaILCR_0-1768176523085.png

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

View solution in original post

5 REPLIES 5

Chaitanya ILCR
Giga Patron

Hi @sparkles ,

 

you can use count data pill from the lookup records action 

if it's greater than 0 then send the email 

ChaitanyaILCR_1-1768176530229.png

 

ChaitanyaILCR_0-1768176523085.png

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

Dinesh Chilaka
Kilo Sage

Hello @sparkles ,

If you expand the step 1 in your flow, there is a checkbox called Don't fail on error , you need to check that field and before step 2 add If condition which checks the drag the data pill of the step 1 status message is sucess or not 

It the step 1 status message is success then only perform step 2 ,step 3 and step 4 else end flow.

If my response funds helpful, please mark my response as helpful and access the solution.

Ankur Bawiskar
Tera Patron

@sparkles 

approach shared by @Chaitanya ILCR should help you

Use that and share feedback

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

VaishnaviK3009
Kilo Sage

Hi @sparkles !!

Issue:
The flow sends an email even when no tickets are closed.

Reason:
In Flow Designer, the For Each action is considered successful even if the Look Up Records action returns 0 records. Because of this, the flow continues to the Send Email action regardless of whether any records were updated.

Solution:
Add an IF condition to check whether any records were returned before sending the email.

Steps:

  1. Use the Record Count output from the Look Up Records action.

  2. Add an IF condition after the For Each loop.

  3. Configure the condition as:

    Look Up RecordsRecord Count > 0
  4. Move the Send Email action inside the IF block.

Flow structure:

Trigger (Daily)
→ Look Up Records
→ For Each Item
     → Update Record (Close Ticket)
→ IF Record Count > 0
     → Send Email

Result:
The email will be sent only when at least one ticket is auto-closed, preventing unnecessary notifications when no records are updated.

 

Mark this as Helpful if it clarifies the issue.
Accept the solution if this answers your question.

Regards,
Vaishnavi
Associate Technical Consultant