How to pass event values to the notification?

Sathwik1
Tera Expert

Hi Team,

In a schedule job I had an event, and in the event through array I am passing two numbers... so how can I get those numbers in notifcations.

while(gr.next())
{
arr.push(gr.number);
}
gs.eventQueue('trigger.an.event', gr, arr);

Now arr contain two numbers like.. INC000301, RITM000201..

and I created a notification, in "when send" I selected "Trigger by event" and selected event name...

Now my doubt is in email body how did I get the numbers which was in arr?

can some one please help me..

@Ankur Bawiskar @Jaspal Singh @AnirudhKumar 

 

1 ACCEPTED SOLUTION

Looks okay to me. 

Can you put a Log in your Mail script after line number 6 as below:

gs.info('Value coming in param is ' + getArray);

Please check on what is coming.

Also just to be extra cautious not sure might be the cause, try changing the Name of your email script to something else like as below:

"getDetails"

Also remove the space between the colon and your Mail script name in your notification and write it as below:

${mail_script:getDetails}

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

12 REPLIES 12

Looks okay to me. 

Can you put a Log in your Mail script after line number 6 as below:

gs.info('Value coming in param is ' + getArray);

Please check on what is coming.

Also just to be extra cautious not sure might be the cause, try changing the Name of your email script to something else like as below:

"getDetails"

Also remove the space between the colon and your Mail script name in your notification and write it as below:

${mail_script:getDetails}

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Wahhh, after changing the email script name it worked...

Thank you @shloke04 !

just one more query.. please help for this... I will create a new question if you want..

Now Output

INC0000001RITM0010001

Expected Output(In table format)

     Number
  INC0000001
  RITM0010001

 

 

@Sathwik 

For that you need to make use of below line of code :

template.print("<br />")

So updated script will look like below:

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

    // Add your code here
    var getArray  = event.parm1.toString();
	var splitStr = getArray.split(',');
	for(var i=0;i<splitStr.length;i++){
		template.print('Value is '+ splitStr[i]);
                template.print("<br />");
	}

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

Regards,

Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke