Join us Dec. 16 for The Community Hour, our first global virtual User Group event!

Business rule on sys_email table

JohnnySnow
Mega 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

 

8 REPLIES 8

Hello @Ankur Bawiskar ,

 

Is it not recommended to have before BR on sys_email table? we have a requirement to check the user from sys_email table and query the user table and fetch the user name then map it to user id in the sys_email. we are thinking to acheive it in before insert BR, what's your thought on this one?

@Mahalakshmi Rav 

please post a new question and share all the details there and tag me as this is an old thread

sushantmalsure
Mega Sage

The even name which you see there is nothing but email log from table (sys_email_log).

from BR on sys_email table, you can write following script to get event name:

 

var getEvent = new GlideRecord('sys_email_log');
	getEvent.addQuery('email',current.sys_id);
	getEvent.query();
	if(getEvent.next()){
		gs.addInfoMessage('Event name is '+getEvent.event.getDisplayValue());
	}

Prathmeshda
Tera Guru

Hello @JohnnySnow 
  current.event is the reference to the Event table (sysevent).
  current.event.name fetches the actual event name.

           Instead of creating a BR on sys_email, use one of these:

           Event Script – Triggered when a specific event fires.
           Script Action – Fires when an event occurs; you can check the event name and perform actions.
              if (event.name == 'incident.assigned') {}

If this response proves useful, please mark it as Accept as Solution and Helpful. Doing so benefits both the community and me. 👍🙂