Business rule on sys_email table

JohnnySnow
Kilo Sage

Hi Team,

 

I want to use the event name in the business rule condition (created on sys_email table ). I'm not sure how to determine or rather dot walk the event name. Can some one please guide 

 

JohnnySnow_0-1689675246711.png

 

Thanks
Johnny

Please mark this response as correct or helpful if it assisted you with your question.
5 REPLIES 5

Community Alums
Not applicable

Hi @JohnnySnow ,

Events are special records that the system uses to log when certain conditions occur and to take some kind of action in response to the conditions.

The system uses business rules to monitor for system conditions and to generate event records in the Event [sysevent] table, which is also known as the event log or event queue.

Event-generating business rules typically use this script logic:

If [some condition is true for the current record], then [add a specific event to the queue].

For example, here are some of the conditions in the incident event business rule:
  • If a user adds a comment to an incident record, add an incident.commented event.
  • If a user adds an incident record, add an incident.inserted event.
  • If a user updates an incident record, add an incident.updated event.
Event-generating business rules use the GlideSystem eventQueue method to insert event records, which typically contain this information:
Event fields
Field Description
Name Unique name of event. Baseline event names include the record affected and the triggering action, such as incident.commented.
Parm1 Event-specific parameter the system uses to pass record information to other parts of the system, such as a record Sys ID or a field value.
Parm2 Event-specific parameter the system uses to pass record information to other parts of the system, such as a record Sys ID or a field value.
Table Table to which the event applies. This is the same table on which the business rule ran.
Instance Sys ID of the record to which this event applies.
Scheduled jobs periodically read the event queue and forward them to the appropriate handler for processing. The handler uses information from event records to take some kind of action such as:
  • Run a script action
  • Schedule a job
  • Send a notification
  • Trigger a workflow activity
  • Trigger an inactivity monitor

By default, the system provides events covering a broad view of application activity. If existing events do not meet your needs, you can create your own events to watch for specific changes to records.

 

 

Ankur Bawiskar
Tera Patron
Tera Patron

@JohnnySnow 

why to create BR on OOB table?

It's not recommended.

What's your use case?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar I wanted to attach the pdf to the email notification, I can’t use the include attachments option as there would be other attachments on the hr case which might not be relevant. I’m sending this notification from a common subflow and that doesn’t  return the sys id, hence thought of achieving through business rule. Is there other ways to achieve it?

Thanks
Johnny

Please mark this response as correct or helpful if it assisted you with your question.

@JohnnySnow 

then you can have after insert BR on sys_email table and copy the required file you want to the email record

what script did you start with and where are you stuck?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader