The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Stop addInfoMessage Displaying twice

aladpereira
Mega Expert

Hello,

I am using a BR script in Test Management module to update test case Execution status based on Child test status. But the addInfoMessage displays twice. How to stop it

Tried this script running in Before and After scripts couldn't fix it:

Running the script in--   test case[tm_test_case_instance] table

  var sysid = current.sys_id;

      var ctest = new GlideRecord("tm_test_instance");           // test table

      ctest.addEncodedQuery('execution_status!=passed^tm_test_case_instance='+sysid);

      ctest.query();

        if (ctest.getRowCount()==0)

              {

              gs.addInfoMessage("passed");

              }

addinfomessage error.jpg

How to fix this, anything wrong with the script?

Thanks,

Alad.

12 REPLIES 12

anupama8
Tera Expert

Hi,



Please check if you have any Business Rule which is running on "Before" and containing current.update().





PS: Hit answered, like, Helpful or Correct depending on the impact of the response.


Hi Anupama,



Checked all the Business rule in that table [tm_test_case_instance]. No Business Rule which is running on "Before" and containing current.update(). I have checked this in a new instance by enabling the test management module and running the script, still the same behavior.   Don't know whats going wrong.


The SN Nerd
Giga Sage
Giga Sage

I've come across this issue pre-Geneva and done the same debug, just to find that the business rule is only shown as being run once, yet the info message *sometimes* shows twice.



Try this without any logic and just an addInfoMessage on it's own and you will find it still shows twice.


I would log this to HI.



As a workaround, you could set a scratchpad variable in your display business rule and check for it in an onLoad client script, which would then use g_form.addInfoMessage.



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022