How to stop sending an email with attachment when no records are fetched from Analytics

harishyara
New Contributor III
New Contributor III

Hello Everyone

Facing an issue : Attachment with no data/records is being sent to the recipients even though analytics returns zero records. How can we stop sending an email with attachment if analytics returns no records?

@rushikeshvartak  @pmahalle 

1 REPLY 1

pmahalle
Valued Contributor II
Valued Contributor II

Hi @harishyara 

Use below expression in TO field of the Email Template. It will restrict email to be sent in case report return zero results. Replace receiptant email expression in below at highlighted place

<%if (totalRecords.equals(0)) print "NULL" else print "${ownerEmail}" %>  


Regards,

Pandharinath Mahalle(Paddy)
If this reply answered your question, please Accept it As Solution to help others who may have a similar problem.