Info Message not populated on the form

Saranya2
Tera Contributor

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);

10 REPLIES 10

Grow2Dev
Tera Guru

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:

Grow2Dev_0-1672945511355.png

 


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

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.

 

popo aff ci.PNG

Thanks,

Saranya

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



Hi @Grow2Dev,

This is how we configured BR.

po bR.PNG

Thanks.