Do not send scheduled report if parent report has no records

Tapish Sharma1
Kilo Sage

Hi Folks,

I have created a scheduled report and it includes two other reports, If the parent report doesnt have any records then even if other reports have record the email should not go out....currently even if I select 'omit if no records' on parent report and if other reports have record the email is going out with those reports getting attached .... Any OOB way to achieve it ?

2 REPLIES 2

Mohith Devatte
Tera Sage
Tera Sage

hello @Tapish Sharma1 ,

try doing conditional scripting by checking conditional check box and in that script you can glide record to parent table where the parent report is configured on and build the exact same query which you gave in report and fetch the count and if the count is 0 return false 

Screenshot 2022-11-14 at 15.58.26.png

var gr = new GlideRecord('your_parent_table');
gr.addQuery('field_name','value');
gr.query();
var count = gr.getRowCount();
if (count==0)
{
return false;
}
else
{
return true;
}

Hope this helps 

Mark the answer correct if this helps you

Hi , thanks for your reply 

For some reason the conditional scripting works if the report is not included with any other report.....If it is included the email still goes out