How to call script include in business rule?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 10:28 PM
How to call script include in the business rule to trigger the notification to users. Please suggest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 10:32 PM
Hi,
normal syntax and pass the current object
var obj = new ScriptIncludeName().functionName(current);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 10:41 PM
Hi Ankur,
should I use like below?
var st = current.getValue("state");
if(st=='3') {
var x= current.vendor_contact.email.toString();
var obj = new ScriptIncludeName().functionName(current);//I updated the script include name and functionname here.
gs.eventqueue("event_name(used in notification)",current, x ,"");
}
else{
var y= current.assigned_to.email.toString();
gs.eventqueue("event_name(used in notification)",current, y ,"");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 11:05 PM
Hi,
Can you share your BR script and why you wish to use script include?
what have you written in script include?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 11:23 PM
Hi Ankur.
Business Rule
var st = current.getValue("state");
if(st=='3') {
var x= current.vendor_contact.email.toString();
gs.eventqueue("event_name(used in notification)",current, x ,"");
}
else{
var y= current.assigned_to.email.toString();
gs.eventqueue("event_name(used in notification)",current, y ,"");
}