Queue an event without the 'current' record?

dstuart
Kilo Expert

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

13 REPLIES 13

Chuck Tomasi
Tera Patron

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');


Thanks Chuck,



I'll try that.




Dave


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.


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