Send notification with list of users who are not submitted their timecards

RAYAPPA Y
Tera Contributor

I would like to send a notification to all line managers every Monday morning, containing a list of users who have not submitted their timecards for the last week. This list should include all users who have pending or recalled timecards (meaning that they have created a timecard but not yet submitted it) as well as those who have not even created a timecard (meaning that no record is available). Can someone please help me with this. Thanks in advance.

3 REPLIES 3

PVJShareKnowled
Tera Guru

What is the timecard table name? Please share.

If this input helped you, please give a thumbs up. It encourages me to answer more questions and support our community.

Regards,


Priyanka Jeganathan

Thank you for replying to me, timecard table name: time_sheet

1__AnithaHV
Kilo Sage

Hi @RAYAPPA Y 

Please use the below email script in the email notification.

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {

          // Add your code here
var count = 0;
var timesheet = new GlideRecord('time_sheeet');
timesheet.addEncodedQuery('query the record as per your requirement');
timesheet.query();
template.print('<style>table, th, td {border:1px solid black;}</style>');
template.print('<table>');
template.print('<tr><th>Sl.No</th><th>User Name</th>');
 // table structure
while(timesheet.next())
{
	count = count+1;
	
    template.print('<tr><td>'+count+'</td><td>'+timesheet.field name which has user name+'</td></tr>');
	
}
template.print('</table>');

})(current, template, email, email_action, event);

 

Please let me know if this helped you to resolve your issue.

 

Thanks & Regards,

Anitha H V