Step 3: Create a Script to Generate the Event
- Use the gs.eventQueue() GlideSystem method in any server-side script
Syntax:
gs.eventQueue("<event_name>", object, parm1, parm2);
Example:
gs.eventQueue("problem.myInsertedProblem", current, "Number: " + current.number, "Created by: " + gs.getUserDisplayName());
event_name - name of Event in Registry
object - current, previous, or a GlideRecord Object.
parm1 - optional parameter used to pass a string. If you do not to pass this parameter the convension is to pass gs.getUserID().
parm2 - optional parameter used to pass a string. If you do not to pass this parameter the convension is to pass gs.getUserName().
parm3 - optional parameter can be used to pass the name of a queue. This parameter overwrites a value provided by the Queue field on the Event's Registry record. Syntax example:
gs.eventQueue("problem.myInsertedProblem", current, current.number, gs.getUserDisplayName(), "js_queue");
parm1 and parm2 can be string ("hello world"), properties (current.assigned_to), variables (myString), or methods ( gs.getUserID()).
The example shown calls the registered event problem.myInsertedProblem and passed it the current object, the number of the current record, and the value of gs.getUserDisplayName().