How to send notification to users in a variable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2015 05:37 AM
Hi All,
Can anyone please let me know how to send the notification to the users in variable?
Let's share my scenario
I have one variable 'x' on a variable form ,x contains 10 user id's. Now I need to send a notification to the 10 members who are there in 'x'.
Can anyone please suggest.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2015 05:40 AM
Hi,
Have you tried creating email notification ?
Email Notifications - ServiceNow Wiki
You can write a script (Scripting for Email Notifications - ServiceNow Wiki) and include this script in your email notification using ${mail_script:<script>} tag.
Hope it helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2015 06:25 AM
Via script, you cannot access the proper method to trigger the notification. I'm thinking you can use GlideAjax to pass in the IDs from the variable X to a script include. So from your form, you can do it onSubmit or onChange, whichever you see fit and do a GlideAjax call to a script include. In that script include, just create a function to utilize the gs.eventQueue functionality which will allow you to trigger the notification and pass in 2 parameters. 1 of which can be an array or object that contains those IDs. I'm not certain that this will even work since i haven't tested it but it's a starting point..

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2015 06:25 AM
Hi Kalyan,
You can add the field under "User/groups in fields" under who will receive section of email notification.
If this is variable created on catalog item then you can fetch the variable as
current.variables.u_approver; //assuming call is the name of the varaible created.
Once you fetch the you can push the values to send this for approval. For ex :
answer = [];
var arrAppr = current.variables.u_approver.split(",");
for (var i = 0; i < arrAppr.length: i++) {
answer.push.(arrAppr[i].toString());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2015 09:23 AM
Hi Pradeep,
Thank you.
I have tried your code in the workflow notification but no luck.
My variable in catalog item is list collector, whom ever I have selected in the list collector I want to send my notification to all those guys.
can you suggest .
Thanks