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-05-2023 10:30 AM - edited 01-05-2023 11:05 AM
Hello @Saranya2
did you try to run the BR with only the line for the infoMessage?
For this just comment out the other if else code above and leave only the infoMessage. Then trigger the BR.
If this runs and the message gets displayed, then the BR gets triggered and the error needs to be found inside the if else statement. There you can add log messages in order see where it stops.
Since I don't have further information regarding your config I can only guess.
The first thing that points out to me is the getTableExtensions() function call.
This function is normally part of a Script Include that needs to be initialized first.
Either it is "new TableUtils('tablename')" or "new GlideTableHierarchy('tablename')".
Also check wich parameters it expects where:
If so and the initalization is missing then the script won't reach the infoMessage line.
So try first to run the BR for only the message, then if this runs adjust your code in order to call the function correctly by initalizing the corresponding Script Include and/or add more log messages to your Business Rule.
If this doesn't help and you need further assistance on your issue, then I would recommend you to share more information regarding your configuration. Screenshots help a lot 😉
Else please mark this reply as helpful and as correct if it solved your problem.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2023 12:55 AM
Hi @Grow2Dev,
I have commented all lines & tried to print only info message. Still info message is not showing. Refer below screenshot of script include.
Thanks,
Saranya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2023 01:18 AM
Hello @Saranya2
thank you for getting back to me.
Can you please share screenshots of the configurations of your Business Rule as well?
Else it's hard to help.
It the infoMessage does not run although there is no other code, then it might not get triggered.
So we need to check the config.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2023 01:25 AM