Scheduled Job not triggering event for notification, when there is no time card record for the user

chandan15
Tera Contributor

Hi, we need to get a notification on the end of the week, when forgot to submit time sheet for this week. So I followed below link to write a scheduled job and created an Event and Notification.

https://community.servicenow.com/community?id=community_question&sys_id=f4c9e320db46df804837f3231f96...

But I am getting error that parm1 is not defined.

Scheduled Job:

var gr = new GlideAggregate('sys_user_grmember');
gr.addEncodedQuery('groupLIKEServiceNOW-ITC-RM');
gr.addAggregate('COUNT', 'user');
gr.query();
while (gr.next()) {
    var User = gr.user;
    var gr1 = GlideRecord('time_sheet'); 
    gr1.addEncodedQuery("week_starts_onONLast week@javascript:gs.beginningOfLastWeek()@javascript:gs.endOfLastWeek()^user=" + User);
    gr1.query();
    if (!gr1.hasNext()) {
        gs.eventQueue('tc.norecord.thisweek', current, parm1, parm2);
    }
}

find_real_file.png

Can anyone please suggest !!!!!!!!!

6 REPLIES 6

Oh, sorry, I tried them both

Hi

please have a look on the following excellent page, which explains how to create events: https://developer.servicenow.com/dev.do#!/learn/courses/sandiego/app_store_learnv2_automatingapps_sa...

Then decide what you want to store at parm1 and parm2. These values then can be used in your email notification - for example, to set the recipient.

Kind regards
Maik