The CreatorCon Call for Content is officially open! Get started here.

How to use event.parm1 from one notification to the other notification

miro2
Mega Sage

Hi

I've got two different notification and workflow using two Run scripts

In the first run script I store callers in array and using parm1 to send emails to them.
Second run script collects some records as a parm2 and should send email to the same callers like parm1.

Anyone knows how to deal with it? How to use parm1 from first run script to the second one?

1 ACCEPTED SOLUTION

Hi,

Then use this code


Thanks,

var recList = [];
var queryString = 'type=normal';
var gr = new GlideRecord("change_request");
gr.addEncodedQuery(queryString);
gr.query();
while (gr.next()) {
    recList.push(gr.sys_id + '');
}
var abc = workflow.scratchpad.parameter1;
var spl = abc.split(',');
for (var i = 0; i < spl.length; i++) {
    gs.eventQueue('rec_list', null, spl[i], recList);
}


Thanks,
Ashutosh

View solution in original post

12 REPLIES 12

HI,

You are not using recList[i]

Use as below

 gs.eventQueue('rec_list', null, workflow.scratchpad.parameter1, recList[i]);

 

One more thing:

for (var i = 0; i < recList.length; i++) {
    gs.eventQueue('rec_list', null, workflow.scratchpad.parameter1, recList);
}

 

According to the length of the recList it will send email. If you want one email then dont use this above forloop just use the event line.

 

Thanks,
Ashutosh

That's not what I meant, I need scratchpad iteration 

HI,

So in param 1 you need single email id and in param 2 whole recList?


Is this true, if no then explain?

Thanks,
Ashutosh

that's right, in the second script parm1 should be single sys_id and parm2 should be array of recList

Hi,

Then use this code


Thanks,

var recList = [];
var queryString = 'type=normal';
var gr = new GlideRecord("change_request");
gr.addEncodedQuery(queryString);
gr.query();
while (gr.next()) {
    recList.push(gr.sys_id + '');
}
var abc = workflow.scratchpad.parameter1;
var spl = abc.split(',');
for (var i = 0; i < spl.length; i++) {
    gs.eventQueue('rec_list', null, spl[i], recList);
}


Thanks,
Ashutosh