Time cards did not enter by users last week

maneesh3
Tera Contributor

Hi Team,

How to report on missed time cards by users last week, those users who don't have time cards last week entered. Kindly suggest how to approach this by a report for manager's usage.

Help is really appreciated

Thanks,

Manish

1 ACCEPTED SOLUTION

Mohith Devatte
Tera Sage
Tera Sage

Hello @maneesh 

You can follow this approach .

You can create a schedule job which will run on every Monday at some time as per your time zone

and the script for condition would be like go to time cards table or time sheet table glide any of these and check  if there are any records in pending state .If yes take and push all those users manager into array who are recipients and then trigger an event  by passing manager as recipient and use that event in notification to trigger the notification

May be we can try this kind of script in scheduled job

var managers=[];
var timecard=new GlideRecord('time_card');
timecard.addQuery('state','Pending');   
timecard.addEncodedQuery("week_starts_onONLast 7 days@javascript:gs.daysAgoStart(7)@javascript:gs.daysAgoEnd(0)^user=javascript:gs.getUserID()");
timecard.query();
while(timecard.next()){
var obj={};
obj.user = timecard.user.toString();
obj.manager=timecard.user.manger.toString();
managers.push(obj);
}
gs.eventQueue('your event name',timecard,JSON.stringify(managers),""); //pass the array of JSON as parameter 1 so that you can write an email script and  fetch the manager and user and print it through email script and use the email script in notification

Please mark my answer correct if it gave you an idea

View solution in original post

3 REPLIES 3

Mohith Devatte
Tera Sage
Tera Sage

Hello @maneesh 

You can follow this approach .

You can create a schedule job which will run on every Monday at some time as per your time zone

and the script for condition would be like go to time cards table or time sheet table glide any of these and check  if there are any records in pending state .If yes take and push all those users manager into array who are recipients and then trigger an event  by passing manager as recipient and use that event in notification to trigger the notification

May be we can try this kind of script in scheduled job

var managers=[];
var timecard=new GlideRecord('time_card');
timecard.addQuery('state','Pending');   
timecard.addEncodedQuery("week_starts_onONLast 7 days@javascript:gs.daysAgoStart(7)@javascript:gs.daysAgoEnd(0)^user=javascript:gs.getUserID()");
timecard.query();
while(timecard.next()){
var obj={};
obj.user = timecard.user.toString();
obj.manager=timecard.user.manger.toString();
managers.push(obj);
}
gs.eventQueue('your event name',timecard,JSON.stringify(managers),""); //pass the array of JSON as parameter 1 so that you can write an email script and  fetch the manager and user and print it through email script and use the email script in notification

Please mark my answer correct if it gave you an idea

Tony Chatfield1
Kilo Patron

Hi, it is not possible to report on something that doesn't exist\has not happened,
so while you could provide a report of all users who have created time cards reporting on those that have not is not an OOB deliverable.

This requirement is very similar to this one

send an email when previous week time card is not submitted - Strategic Portfolio Management (SPM) -...

and I think you would need to consider a similar solution - that is a scheduled job\script to identify the users who have not met the requirement.

One other option may be to create 0 value times cards at the beginning of each week for all users, and then report on the ones that were not updated by end of week, but this would be very dependent on your operational processes and may not be a good fit.

chintu
Tera Contributor

Hii! maneesh.

If you don't mine can please share the screenshorts that you have done.

I have the similar requirement as you.

Thank you!