In an inbound action script, what is "email"? is it a object or what?

nirwan_ritik
Tera Contributor

If yes, how to pass this object to event so that the script getting fired by the event will be able to use all the email entities. (like any string passed in the email in key value format)

1 ACCEPTED SOLUTION

Peter Bodelier
Giga Sage

Hi @nirwan_ritik,

 

Yes it is an object. This article explains it a bit:

Accessing email object variables (servicenow.com)

 

You could pass this object as JSON string to the event:

 

var emailJson = JSON.stringify(email);

 

 

 

In the script action you could use it again as: 

 

var email = JSON.parse(event.parm1)

 

 

I think you could send the sys_email global variable as GlideRecord in the inbound action, without having to query it first. If that doesn't work, you'll have to query the record first to pass it.

 

So all in all it would look something like this:

var emailJson = JSON.stringify(email);
var dt = new GlideDateTime();
dt.addSeconds(20*60);

gs.eventQueueScheduled('<<eventname>>', sys_email, emailJson, parm2 (optional), dt);




Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

View solution in original post

2 REPLIES 2

Peter Bodelier
Giga Sage

Hi @nirwan_ritik,

 

Yes it is an object. This article explains it a bit:

Accessing email object variables (servicenow.com)

 

You could pass this object as JSON string to the event:

 

var emailJson = JSON.stringify(email);

 

 

 

In the script action you could use it again as: 

 

var email = JSON.parse(event.parm1)

 

 

I think you could send the sys_email global variable as GlideRecord in the inbound action, without having to query it first. If that doesn't work, you'll have to query the record first to pass it.

 

So all in all it would look something like this:

var emailJson = JSON.stringify(email);
var dt = new GlideDateTime();
dt.addSeconds(20*60);

gs.eventQueueScheduled('<<eventname>>', sys_email, emailJson, parm2 (optional), dt);




Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

This really helped, Thanks 🙂