I need help with a notification trigger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
I will explain how the notification trigger should work:
Basically, I have a Record Producer where I fill in the information with the event date, the time, and the date when the notification should be sent. The type of template the notification will have and the recipients. If the participants field is empty, it should send to everyone in the sys_user table who is active. For the template part, the notification should understand which type of template needs to be used.
I don't know how to do this in ServiceNow, and if it's not possible, please explain why.
#ITSM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @LarissaR4486026 ,
This is a great requirement! You can absolutely achieve this using Flow Designer, which is the modern "Low-Code" best practice.
However, regarding the "send to everyone in the sys_user table" part, I must give you a critical performance warning: Do not create a loop in your Flow to add 5,000+ users one by one. That will crash your instance memory or clog the event queue.
Here is the complete, safe, and scalable architecture to solve your problem:
The Architecture
Custom Table: Stores the Record Producer data.
Flow Designer: Handles the "Waiting" (Scheduling) and Logic.
Groups: Handles the "All Users" requirement safely.
Events/Notifications: Handles the specific Templates.
Step 1: The Safety Setup (Recipients)
To send to "All Users" safely, do not script a loop.
Best Practice: Create a Group in ServiceNow (e.g., "All Employees") and add all active users to it.
Alternative: Use a company email alias (e.g., all@company.com) if you have one.
Why? The system can send 1 email to a Group much faster than processing 5,000 individual user records.
Step 2: The Notifications (Templates)
Since you need different templates, the easiest way is to create separate notifications triggered by specific events.
Go to Event Registry and create two events: comm.template_a and comm.template_b.
Create Notification A:
Trigger: Event is fired (comm.template_a).
Recipients: Check "Event parm 1 contains recipient".
Content: Design your Template A here.
Create Notification B:
Trigger: Event is fired (comm.template_b).
Content: Design your Template B here.
Step 3: The Flow Designer Logic
Now, build the Flow to tie it all together.
Trigger: Created on your custom table.
Action 1: Calculate Recipients
Flow Logic (If): Recipients Field IS EMPTY.
Action: Set a Flow Variable target_recipient = SysID of "All Employees" Group.
Flow Logic (Else):
Action: Set a Flow Variable target_recipient = Recipients Field (from the record).
Action 2: The Scheduling
Action: Wait for a duration (or "Wait for Condition").
Config: Wait until Current Date/Time is at or after Event Date.
Benefit: The Flow automatically pauses and wakes up on the correct day. No code needed!
Action 3: The Template Decision
Flow Logic (If): Template Type IS "Type A".
Action: Trigger Event
Event Name: comm.template_a
Record: [Trigger Record]
Parm 1: target_recipient (The variable from Step 1)
Flow Logic (Else If): Template Type IS "Type B".
Action: Trigger Event
Event Name: comm.template_b
Record: [Trigger Record]
Parm 1: target_recipient
Summary
Scheduling: Handled by Flow Designer "Wait" step.
Templates: Handled by the If/Else logic triggering specific Events.
All Users: Handled safely by passing a single Group ID instead of looping through thousands of users.
If this complete guide helps you build your solution safely, please mark it as Accepted Solution.
Best regards,
Brandão.
