Info Message not populated on the form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 08:00 AM
Hi All,
I have created After Insert/Update BR, In that I have used gs.addInfoMessage(" "), but the info message is not getting populating.
BR:
(function executeRule(current, previous /*null when async*/) {
var uniqueOutageSysIDs;
if (getTableExtensions('cmdb_ci_server').indexOf(current.cmdb_ci.sys_class_name) != -1)
{
uniqueOutageSysIDs = new AffectedCI().ServerCI(current);
}
else if (current.cmdb_ci.sys_class_name == 'cmdb_ci_business_app')
{
uniqueOutageSysIDs = new PopulateAffectedCI().BusinessAppCI(current);
}
else if (getTableExtensions('cmdb_ci_netgear').indexOf(current.cmdb_ci.sys_class_name) != -1)
{
uniqueOutageSysIDs = new PopulateAffectedCI().NetworkCI(current);
}
gs.addInfoMessage("Affected Cis are attached ");
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2023 01:32 AM - edited 01-06-2023 01:12 PM
@Saranya2
Please also share other screenshots of the tab 'Action' (if sth is configured there) and of "Advanced" tab to see your current code for only the info message.
Else I cannot check for errors.
Btw. the Script Include function expects an object as param. In your original BR script you pass it a table name as string. You need to pass it an object.
And yes, as Ankur said. Later on it's better to move the code to another Script Include.
But first I would recommend you to try to understand your current implementation before you go further. This will improve your learning.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2023 01:27 AM
the code you shared in your question is inside BR
why not put the entire code inside script include and call that script include inside BR?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2023 01:42 AM
Maybe there is another business rule that calls
gs.flushMessages();
?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2023 04:06 AM
Hello @Saranya2 ,
what is the status of your issue?
If any of our replies was helpful to you, then please mark those at least as helpful.
If any of them helped to solve you issue, then please mark as correct as well.
Else, if you need further assistance, then please provide us with the requested information regarding your complete configuration (screenshots etc), so that we can help you further.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 08:23 AM
Hi @Grow2Dev,
In one of our BR we used gs.flushMessages(). After removing that the info message has populated. but it is populating multiple times. Is it something related to Order of the BR?
Thanks,
Saranya