Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Advanced conditions for email notifications global variables (event)

richardhofing
Mega Expert

I am exploring the advanced conditions for email notifications. The documentation states the following:

The advanced condition script uses the following business rule global variables:

  • current: contains the current record from the table to which the notification is linked.
  • event: contains the event that triggered the notification

current I understand, I tried to find examples that use the event variable but I was not successful. If someone could provide a few examples, that would help me greatly!

 

Ric

1 ACCEPTED SOLUTION

ARG645
Tera Guru
richardhofing,
 
Nice question. The event global variable can be used to retrieve the parameters that are passes in the event. Below is a very simple example. 
Lets say you fired an event from Workflow or via code. Lets say the below code is firing the event test_event
 
gs.eventQueue('test_event',current,"Test1","Test2"); //eventQueue(name: string, record: GlideRecord, parm1: string, parm2: string, queue: string)

Below is an example of how you can use the event global variable in your advanced condition script

find_real_file.png

Copy/Paste

var param1= event.parm1;
var param2= event.parm2;

if(param1 == "Test1" && param2=="Test2")
	return true;
else
	return false;

View solution in original post

3 REPLIES 3

ARG645
Tera Guru
richardhofing,
 
Nice question. The event global variable can be used to retrieve the parameters that are passes in the event. Below is a very simple example. 
Lets say you fired an event from Workflow or via code. Lets say the below code is firing the event test_event
 
gs.eventQueue('test_event',current,"Test1","Test2"); //eventQueue(name: string, record: GlideRecord, parm1: string, parm2: string, queue: string)

Below is an example of how you can use the event global variable in your advanced condition script

find_real_file.png

Copy/Paste

var param1= event.parm1;
var param2= event.parm2;

if(param1 == "Test1" && param2=="Test2")
	return true;
else
	return false;

Thank you Aman! That answers my question perfectly.

 

Ric

Joseph Warner1
Tera Contributor

The previous variable is also available in the advanced condition script.