Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Time card reminder on weekly

MK-p
Tera Contributor

employees should submit their time cards by the end of each week (Sunday) for approval. If the time card is not submitted by the due date, a notification should be sent to the employee and their manager as a reminder.

1 ACCEPTED SOLUTION

Runjay Patel
Giga Sage

Hi @MK-p ,

You can follow below steps.

  1. Create one event based notification. check here how: https://servicenowwithrunjay.com/email-notification/
  2. create one schedule job and execute below script.
  3. run schedule jon on every monday so that missed timecard will be in target.

 

var timeCardGr = new GlideRecord('time_card');
timeCardGr.addQuery('state', 'Open');
timeCardGr.query();
while (timeCardGr.next()) {
    var user = timeCardGr.getValue('user');
    var manager = timeCardGr.getValue('manager');
    
    // Send notification to user
    gs.eventQueue('time_card.reminder', timeCardGr, user, manager );
    

}

 

Note: this solution is best for one time card per user per week, if you have multiple time card the glide record on timesheet table to sent notification.

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

View solution in original post

In this series i have explained about ServiceNow Discovery right from scratch like how you can enable the discovery plugin, what are the discovery prerequisites, what all question you should ask for your client before start the discovery implementation, how you can configure discovery schedules ...
2 REPLIES 2

Uncle Rob
Kilo Patron

What have you tried?
If you haven't tried anything... what components would you reach for?

Runjay Patel
Giga Sage

Hi @MK-p ,

You can follow below steps.

  1. Create one event based notification. check here how: https://servicenowwithrunjay.com/email-notification/
  2. create one schedule job and execute below script.
  3. run schedule jon on every monday so that missed timecard will be in target.

 

var timeCardGr = new GlideRecord('time_card');
timeCardGr.addQuery('state', 'Open');
timeCardGr.query();
while (timeCardGr.next()) {
    var user = timeCardGr.getValue('user');
    var manager = timeCardGr.getValue('manager');
    
    // Send notification to user
    gs.eventQueue('time_card.reminder', timeCardGr, user, manager );
    

}

 

Note: this solution is best for one time card per user per week, if you have multiple time card the glide record on timesheet table to sent notification.

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

In this series i have explained about ServiceNow Discovery right from scratch like how you can enable the discovery plugin, what are the discovery prerequisites, what all question you should ask for your client before start the discovery implementation, how you can configure discovery schedules ...