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

@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.

Ankur Bawiskar
Tera Patron
Tera Patron

@Saranya2 

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?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

-O-
Kilo Patron
Kilo Patron

Maybe there is another business rule that calls

gs.flushMessages();

?

Grow2Dev
Tera Guru

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

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