How to pass more than 2 parameters to the eventQueue and access it on the notification

Hari1
Mega Sage

Hi,

I am using an eventQueue on the scheduled job and passing object as a param1.

var arrFinal = [<sys_id> of users];

 var obj = {
        iteration: iterValIncFinalVal,
        lastDate: storeValNextItr
    };

gs.eventQueue('cmp_qualifier', gr, obj, arrFinal);

I need to access both the object value of event.parm1 to be accessible on the notification subject and body.

Can this be achieved?

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

if you are not using parm1 and parm2 for setting recipients then you can use both the parameters to send the values and get that in email script

This will require you to set the recipient from Users/Group field

What's your case?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi,

parm2 has the array of users. I am pass an array as parm2 which is basically the users to who the notification will be sent.

parm1 will have 2 values as an object, I need to access both the values in the notification subject and on the notification email body.

Thanks.

Anil Lande
Kilo Patron

Hi,

You can access these values in email scripts and parse it to print the values:

 var obj = JSON.parse(event.parm1);

var iteration = obj.iteration;

var lastDate = obj.lastDate;

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

I have added the below code by creating an email script. How to access this in the email notification?

Email script:

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {

         var getParamValue = JSON.parse(event.parm1);
	
		gs.info('getParamValue: ' + getParamValue);
	gs.info("getParamValue.iteration:" + getParamValue.iteration);
	gs.info("getParamValue.iteration:" + getParamValue.lastDate);

})(current, template, email, email_action, event);

 

find_real_file.png