- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2022 01:17 AM
I have a requiremenet to Create a Business Rule that will output information about Incidents with the same Caller. When a new Incident is created, search the database for other Incidents that have the same value in the field Caller and use gs.addInfoMessage() method to display their Numbers at the top of the page.
Solved! Go to Solution.
- Labels:
-
Multiple Versions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2022 01:48 AM
@lakshmi
Try this:
(function executeRule(current, previous /*null when async*/ ) {
var arr = [];
var grI = new GlideRecord("incident");
grI.addQuery("caller_id", current.getValue("caller_id"));
grI.addActiveQuery(); //use this to return active incidents
grI.query();
while (grI.next()) {
arr.push(grI.getValue("number"));
}
gs.addInfoMessage("Caller Incidents are:" + arr.toString());
})(current, previous);
Hope it helps
Thanks,
Murthy
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2022 01:32 AM
Hi Lakshmi,
You can use after insert BR on incident table.
Have you written anything?
Thanks
Murthy
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2022 01:38 AM
Hi,
I have tried afert insert Br and glided incident table and gave conditions for matching current caller_id .
But failed to display list of incidents.
Thanks,
Lakshmi.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2022 01:40 AM
Can you share your script?
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2022 01:48 AM
@lakshmi
Try this:
(function executeRule(current, previous /*null when async*/ ) {
var arr = [];
var grI = new GlideRecord("incident");
grI.addQuery("caller_id", current.getValue("caller_id"));
grI.addActiveQuery(); //use this to return active incidents
grI.query();
while (grI.next()) {
arr.push(grI.getValue("number"));
}
gs.addInfoMessage("Caller Incidents are:" + arr.toString());
})(current, previous);
Hope it helps
Thanks,
Murthy
Murthy