Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Send notification once at 30 days and 60 days

Bridgina Starr
Tera Contributor

Hi,

I am not sure I am putting this in the right forum but hope someone can assist.

I have created 2 notifications to send to ITIL users that have not logged in for over 30 days and 60 days.

 

Scenario 1:

ITIL user has not logged in for over 30 days

  1. Event: Last.login

  2. Notification: ITIL users not logged in for over 30 day

    1. Send When: Event is fired
  3. Scheduled job: Send ITIL not logged in for 30 days

    1. var gr = new GlideRecord('sys_user');
      gr.addEncodedQuery('roles=ITIL^active=true^last_login<javascript&colon;gs.beginningOfLast30Days()^ORlast_loginISEMPTY');
      gr.query();
      while(gr.next()){
      gs.eventQueue("Last.login", gr);
      }
  4. Job runs daily
  5. Issue: Some users are getting the email notification every day and I only need it to send to them once 

Scenario 2:

ITIL Users not logged in for over 60 days

Created in Dev:

  1. Event: Last.login60

  2. Notification: ITIL users not logged in for over 60 day

    1. Send when: Event is fired
  3. Scheduled job: Send ITIL not logged in for 60 days

    1. var gr = new GlideRecord('sys_user');
      gr.addEncodedQuery('roles=ITIL^active=true^last_login<javascript&colon;gs.beginningOfLast60Days()^ORlast_loginISEMPTY');
      gr.query();
      while(gr.next()){
      gs.eventQueue("Last.login60", gr);
      }
  4. Job runs daily
  5. Issue: Some users are getting the email notification every day and I only need it to send to them once

I would appreciate any assistance on how to have the job run daily but only send the notification to the user once.

 

Thanks,

Gina

6 REPLIES 6

gurjot5
ServiceNow Employee

@Bridgina Starr if this solved your issue please mark the response as helpful and please accept the solution so that others can benefit from the content , thank you 😊.

Hi,

I appreciate your input. I have tried this, and it is not working. I think it may have something to do with "gr.user.email_id" but don't know for sure. I am working with another developer, but we have been quite busy and have not gotten a chance to back to this. I also just noticed that you have "contains" in your script but ours has like so I am going to go back and try that and see. I will keep you updated, and I am sorry for the delay.

 

Thanks,

Gina