Journey Accelerator task Due/Overdue Notifications are not triggering

charitha2
Tera Contributor

Hi,

I am trying to find the job/script that triggers the OOTB 'JA Task Due' & 'JA Task Overdue' Notifications events-
sn_ja.notification.due
sn_ja.notification.overdue
Is there an OOTB schedule job that triggers these events used in these notifications? I wasn't able to find one.

Thanks in Advance!

3 REPLIES 3

MohanapriyaC
Tera Contributor

Hi,

 

Did you find the answer, i am also trying to find same thing.

 

Thanks,

Mohanapriya

sn_ja.notification.due - This event triggered from Task due notification flow
sn_ja.notification.overdue - This event triggered from Task overdue notification flow

 

Please mark my answer is correct if that helps!

_ukasz Rybicki
Giga Guru

Initial Answer

Problem Name: No OOTB Scheduled Job for JA Task Due/Overdue Notifications 😊

General proposed solution (≤100 words):
Create a single Scheduled Script Execution in the sn_ja scope that runs daily (e.g. at 2 AM), queries the sn_ja_journey_task table for tasks in pending/in-progress states, and uses gs.eventQueue(...) to fire the built-in sn_ja.notification.due and sn_ja.notification.overdue events based on each task’s due_date ⚙️

Detailed step-by-step proposal (≤250 words):

  1. Navigate: System DefinitionScheduled Script Executions and click New.

  2. Configure header:

    • Name: JA Task Due/Overdue Notifications

    • Application: Journey Accelerator (sn_ja)

    • Run: Daily at 02:00

  3. Script:

    (function() {
      var gr = new GlideRecord('sn_ja_journey_task');
      gr.addQuery('state','IN','pending,in_progress'); 
      gr.query();
      var todayStart = gs.beginningOfToday();
      var todayEnd   = gs.endOfToday();
      while (gr.next()) {
        var due = new GlideDateTime(gr.getValue('due_date'));
        if (due.compareTo(todayStart) >= 0 && due.compareTo(todayEnd) <= 0) {
          gs.eventQueue('sn_ja.notification.due', gr, gr.sys_id, gr.assigned_to);
        } else if (due.compareTo(todayStart) < 0) {
          gs.eventQueue('sn_ja.notification.overdue', gr, gr.sys_id, gr.assigned_to);
        }
      }
    })();
  4. Save 🔄 and activate the job.

  5. Test: Adjust a sample task’s due_date to today/past, wait for the next run, then verify System Logs ➔ Events and email receipts 🧪.

Example solution (≤100 words):
An HR manager (role: sn_ja_manager) in the Employee Center receives a Task Due email when an onboarding “Plan Participant Task” reaches its due date, and a Task Overdue reminder 24 hours after it slips past due. Module: Journey Accelerator 📧👥

Please mark this as the correct answer!


Sources:

  1. Scheduled Script Execution Scripts – ServiceNow Developers: details how to create a scheduled script and use gs.eventQueue() to fire events on records

  2. Notify using Scheduled JOBS in ServiceNow – Kailash Bhange, Community article on registering events and creating scheduled jobs that queue notifications


Analysis of the Initial Answer

  1. Assumption of a custom job: The answer presumes no OOTB scheduled job exists for these events; this is based on the original thread but not explicitly documented.

  2. Schedule timing: The 02:00 AM schedule is a guess; actual run times should match business needs.

  3. Script scope and performance: Putting all logic in one script is simple but may grow heavy as task volume increases; splitting into two jobs (due vs. overdue) could improve maintainability. 🛠

  4. Date comparison logic: Using compareTo() on GlideDateTime ensures proper comparison, but edge cases (time zones, record time vs. date-only fields) should be tested. 🌐

  5. Alternative no-code solution: Flow Designer offers “Scheduled Flows” that can perform the same without scripting, which may better align with best practices. 🔄


Final Version

Problem Name: No OOTB Scheduled Job for JA Task Due/Overdue Notifications 🎯

General proposed solution (≤100 words):
Create a Scheduled Script Execution in the sn_ja scope that runs each night, iterates through sn_ja_journey_task records in pending/in-progress states, and uses gs.eventQueue() to fire the built-in sn_ja.notification.due (for today’s due tasks) and sn_ja.notification.overdue (for past-due tasks) events 🚀

Detailed step-by-step proposal (≤250 words):

  1. Go to: System DefinitionScheduled Script Executions, click New.

  2. Set properties:

    • Name: JA Task Due/Overdue Notifications

    • Scope: sn_ja

    • Run: Daily at your preferred hour.

  3. Add this script:

    (function() {
      var gr = new GlideRecord('sn_ja_journey_task');
      gr.addQuery('state','IN','pending,in_progress');
      gr.query();
      var start = gs.beginningOfToday();
      var end   = gs.endOfToday();
      while (gr.next()) {
        var due = new GlideDateTime(gr.due_date + ' 00:00:00');
        if (due.compareTo(start) >= 0 && due.compareTo(end) <= 0)
          gs.eventQueue('sn_ja.notification.due', gr, gr.sys_id, gr.assigned_to);
        else if (due.compareTo(start) < 0)
          gs.eventQueue('sn_ja.notification.overdue', gr, gr.sys_id, gr.assigned_to);
      }
    })();
  4. Save and activate the job.

  5. Verify: Set a test task’s due_date to today or yesterday, let the job run, then check System LogsEvents and email inbox for due/overdue notifications.

Alternative: Use a Scheduled Flow in Flow Designer—no scripting required—to query the same table and “Fire Event” actions for each condition.

Example solution:
An HR specialist (sn_ja_hr) gets an “JA Task Due” email when an offboarding checklist item is due today, and an “JA Task Overdue” reminder if not completed by the next day. Module: Journey Accelerator 📑📩

Please mark this as the correct answer!

Sources:

  1. Scheduled Script Execution Scripts – ServiceNow Developers: guidance on building Scheduled Script Executions and using gs.eventQueue()

  2. Notify using Scheduled JOBS in ServiceNow – Kailash Bhange, Community article detailing event registration and scheduled job setup for notifications