How to create an event in run script?

SNnewbie2
Tera Expert

How do I create an event using an script in run script? I want to be able to create an event to create a notification for each person I want to send it to.

35 REPLIES 35

Generally, you'd raise the event and pass the sys_id of the record you're interested in.



Then you'd create a response against this event which uses the sys_id to identify the appropriate record, bringing out record attributes as you see fit.



Normally you'd not try to pass all the info as a parameter - treat the record as an object and pass a reference to it.



For what it's worth, this is exactly the topic we cover on our Script course: Scripting in ServiceNow


Yeah I would love to take the course but it is out of my budget. So I am trying lo learn by my own.


I used gs.eventQueue("catalog.opening.dns.notification", current, email_id, email_id); to create an event but it doesn't create the event 😕


I used gs.eventQueue("catalog.opening.dns.notification", current, email_id, email_id); to create an event but it doesn't create the event 😕


Did you register this event?


Yes, I did. I was able to see it in my event log. but the notification is never sent out ...


find_real_file.png


Can you do gs.eventQueue("catalog.opening.dns.notification", current, current.cmdb_ci.owned_by, email_id);



It should still fire the event.   You can do a gs.log(current.number) to see that it is in the run script portion.