Lesson 5
Trigger email and even
To trigger an email (and potentially in ServiceNow itself), you’ll need to define an event and then configure a notification or flow to respond to that event. This often involves using a business rule or a flow designer to fire the event and a separate notification to send the email, according to ServiceNow documentation.
-
Create an event:Navigate to “System Policy > Events > Registry” and create a new event record.
-
Give it a name:Choose a descriptive name for your event (e.g.,
incident.reassigned.no.assignee). -
(Optional) Define parameters:
If your email needs to include information from the record, define event parameters (e.g.,
parm1for the incident number,parm2for the new assignee).
-
Business Rule:
Create a business rule (usually an “after” or “async” business rule) that runs when the record is updated (e.g., when an incident is reassigned).
-
Condition:
Set a condition in the business rule to check if the incident has been unassigned for more than a specific time (e.g., 24 hours).
-
Event Firing:
In the business rule, use the
gs.eventQueue()method to fire the event when the condition is met. For example:
gs.eventQueue('incident.reassigned.no.assignee', current, current.assigned_to.getDisplayValue(), current.number);
This line fires the event, passes the current incident record, the assigned to user’s display value, and the incident number as parameters.
- Flow Designer: You can also use Flow Designer to trigger the event. Create a new flow, set a trigger (e.g., when an incident is updated), and use the “Fire an Event” action to trigger your custom event.
-
Create a notification:
Navigate to “System Policy > Notifications” and create a new notification record.
-
Select the table:
Choose the table associated with the event (e.g., Incident table).
-
When to send:
Set the “Send when” field to “Event is fired” and select your custom event.
-
Who will receive:
Configure who should receive the email notification. You can use the event parameters to dynamically add recipients (e.g., checking “Event parm 1 contains recipient” and adding
current.assigned_to.emailto the recipient list). -
What to send:
Compose the email content. Use the event parameters to include relevant information in the email body.
- Create a new flow and set the trigger to “Record updated” on the Incident table.
- Add a condition to check if the “Assigned to” field is empty.
- Add a “Wait” action to pause execution for 24 hours.
- Add another condition to check if the “Assigned to” field is still empty after the wait.
- Add an action to “Fire an Event” and select your custom event (e.g.,
incident.reassigned.no.assignee). - Configure the notification as described above, using “Event is fired” and your custom event.
