- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2022 09:39 AM
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..
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2022 11:19 AM
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
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2022 09:48 AM
Hi Sathwik,
you will need an email script (see https://docs.servicenow.com/bundle/paris-servicenow-platform/page/script/server-scripting/concept/c_...) which you can call within your email message field.
In that mail script you have access to the array via
var arrNumbers = event.parm1;
And then iterate over that array and build the output.
Kind regards
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2022 09:57 AM
Thanks for your response..
Can you please help me..on what should I need to write in mail script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2022 10:07 AM
Unfortunately, I don't understand your expectation as you do not provide any more details about what you want to do with the numbers & how the output should look like.
Please read the provided documentation or study the course at https://developer.servicenow.com/dev.do#!/learn/courses/sandiego/app_store_learnv2_automatingapps_sa...
It is everything there. You just have to adopt it to your needs.
Kind regards
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2022 10:16 AM
Hi,
First Point
The below one is my event which I used in schedule job..
gs.eventQueue('trigger.an.event', gr, arr);
Here arr is an array and it contains two values they are INC000120, RITM000210
Second Point
Now I need to pass arr values in the notification body...
How should I pass to notification body? this is my requirement..
is it clear
.
.