Skip to content

Conversation

nilesh-snow-1
Copy link

Summary

Adds a visible banner on NeedIt Task forms when a record is overdue and not closed.
Server-side check done in a Display Business Rule; message rendered by a Client onLoad script.

What changed

  • Business Rule (When: Display): computes isOverdue using GlideDateTime.after(current.due_date) and exposes flags via g_scratchpad.
  • Client Script (onLoad): reads g_scratchpad.isOverdue and displays g_form.addInfoMessage(...).

Files touched:

  • Client Script: Overdue Record warning
  • Business Rule: Alert Generation for Overdue… (Display)

Why

Previously teams attempted to alert from a scheduled/background script (no UI context).
This split cleanly separates UI messaging (form load) from background processing.

How to test

  1. Open any x_58872_needit_needit_task with:
    • due_date in the past, and
    • state ≠ Closed Complete (verify your instance’s closed value; code currently assumes 3).
  2. Reload the form (classic / Next Experience).
  3. Expect to see an info banner: “This task is overdue …”.

Workspace note: Classic onLoad messages don’t appear in Workspace; this PR targets classic/Next Experience forms only.

Implementation details

  • Guarded null dates (addNotNullQuery not required here; Display runs on a single record).
  • Correct date comparison via GlideDateTime.after(...) instead of string/locale compare.
  • Avoids server-side alert() (client-only).
  • No changes to notifications/events/schedules in this PR.

Backwards compatibility

  • Non-breaking; only adds a banner on applicable records.
  • No schema changes.

Risks / mitigations

  • State value drift: If “Closed Complete” ≠ 3 in some environments, banner may show incorrectly.
    Mitigation: configurable state list in follow-up, or switch to an explicit “open states” allowlist.

Screenshots (optional)

  • Add a form screenshot with banner here.

Checklist

  • Tested on a record overdue + not closed
  • Display BR (Advanced, When=Display) active
  • Client Script (onLoad, UI Type=All) active
  • No credentials or customer data in code/comments

admin added 3 commits May 2, 2017 15:09
- Display BR: compute isOverdue via GlideDateTime.after() and expose via g_scratchpad
- Client onLoad: show g_form.addInfoMessage(...) on overdue, non-closed tasks
- Hardened: addNotNullQuery(due_date), avoid server alert(), confirm state code
- Scheduled job kept separate for background escalations via eventQueue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant