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-29-2017 08:38 AM
Morning Chuck,
Well, it's still not working. I'm not sure why. Nothing that I can find in the Error, Warning, or any other logs.
Dave

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2017 08:50 AM
Is the event being triggered showing up in the event log? If not, double check that it is registered.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2017 09:17 AM
Hi Chuck,
Yes, the event is showing int he event log. And the issue I was having was that when the email notification ran, it would never send the email. When I looked into the logs, I would see a log entry saying something like (paraphrased) "<table_name>.<sys_id> is invalid; may have been deleted". Like the System was verifying access to the record pointed to by <sys_id>, even though I wasn't using any fields from the record. If it couldn't access the record, it wasn't going any further.
I'm not sure what I changed, but it's working, now. The email is being sent. I'm just having an issue with optional parameter 1 not being picked up by the email notification. I do have ${event.parm1} in the email notification, but it's not coming across.
So, some progress.
Dave

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2017 06:21 AM
The only way I got this to work was to feed it a valid record. It's doing a check when the notification does the table lookup and says "Is the GlideRecord I got, the same class/type as the notification is looking for?" For my test, I made the notification on sys_user. I triggered the event like this - even though the notification didn't use it.
var usr = new GlideRecord('sys_user');
usr.query();
usr.next();
gs.eventQueue('chuck.test', usr, 'parm1', 'parm2');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2017 10:19 AM
Thanks Chuck,
That's pretty much what I ended up doing.
Dave
Dave Stuart
Principal Info. Systems Support Analyst
County of Ventura
805-662-6731
David.Stuart@ventura.org