Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2023 01:31 AM
Hi @vinod6
Can you elaborate the requirement?
Are you trying to display an info message if an Incident that belongs to that particular problem is resolved? If yes try the below Display Business Rule.
(function executeRule(current, previous /*null when async*/ ) {
var incGr = new GlideRecord("incident");
incGr.addEncodedQuery("problem_id=" + current.getUniqueValue() + "^state=6");
incGr.query();
while (incGr._next()) {
var link = '<a href="' + incGr.getLink() + '">' + incGr.getValue('number') + '</a>';
var message = gs.getMessage('Incident Resolved') + ' ' + link + ' ';
gs.addInfoMessage(message);
}
})(current, previous);
If you want to display Closed incidents also, try below code.
(function executeRule(current, previous /*null when async*/ ) {
var incGr = new GlideRecord("incident");
incGr.addEncodedQuery("problem_id=" + current.getUniqueValue() + "^stateIN6,7");
incGr.query();
while (incGr._next()) {
var link = '<a href="' + incGr.getLink() + '">' + incGr.getValue('number') + '</a>';
var message = gs.getMessage('Incident Resolved') + ' ' + link + ' ';
gs.addInfoMessage(message);
}
})(current, previous);
Please mark my answer helpful and accept as a solution if it helped 👍✔️
Thanks,
Anvesh
Anvesh