Queue an event without the 'current' record?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 03:19 PM
I'm working on an Inbound Email Action. I have it working, but the person requesting it wants me to 'user-proof' it, i.e. send a "failed" notification with the 'source' email in the event the user specifies some invalid data.
So, I know how to enqueue an event, and send an email notification based on that event. But can I enqueue an event without the 'current' record?
Syntax for gs.eventQueue is gs.eventQueue("event-to-be-queued", current-record, optional-parm-1, optional_parm-2);
Obviously, the event name is mandatory. And it also appears that 'current-record' is also mandatory.
My problem is that since the user had a typo, or otherwise specified some 'invalid' data, the insert of the target record failed. And while there is a sys_id to the 'in-process' record when the gs.eventQueue() runs, when the email notification actually gets around to it, the sys_id is no longer valid, and the email notification fails.
I've tried gs.eventQueue("event-name", , optional-parm-1); but that fails, too, because of what I believe is no 'current record'.
Ideas?
Thanks,
Dave
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 03:44 PM
Last time I checked, you can use any GlideRecord as the second parameter in gs.eventQueue().
Example:
var gr = new GlideRecord('sys_user');
gs.eventQueue('event.name', gr, 'parm1', 'parm2');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 03:52 PM
Thanks Chuck,
I'll try that.
Dave

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 03:57 PM
Let me know how it goes.
Normally I'll have a valid record in there - like in a scheduled job. Not just send it off "unpopulated". Often times you'll want to pull information out of a notification for field values. If you send in an empty GlideRecord, there won't be anything to use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 04:02 PM
I agree completely, and that's usually what we do. But in this case, there is no record to pull fields from. What I do want, though, is the email that triggered the process. I think I have it working. I'll no more tomorrow morning.
Dave