addInfoMessage on g_list

medha_singri
ServiceNow Employee
ServiceNow Employee

I have a glideAjax on UI action (List Choice). Lets say, addInfoMessage is added from the server-side, its gone when I referesh the list, irrespective of before or after the ajax call. If I return the message to ajax call, g_list doesnt have addInfoMessage, how could I display it. Any help is much appreciated. Below is my code snippet.

function onClickFunctionName() {

  var selSysIds = g_list.getChecked();

  g_list.setFilterAndRefresh("");

  var ga = new GlideAjax('scriptName');

  ga.addParam('sysparm_name', 'funName');

  ga.addParam('sysparm_sys_id', selSysIds);

  ga.addParam('sysparm_show_msg', false);

  ga.getXMLAnswer(function(response){

          //GlideList2.get("tableName").setFilterAndRefresh("");

  });

}

Thanks,

Medha

1 ACCEPTED SOLUTION

venkatiyer1
Giga Guru

Hi Medha,



Try using the below function. It should work.




The first parameter is the message.


addFormMessage("Testing", "info", 0) // for info


addFormMessage("Testing", "error", 0) // for error


View solution in original post

18 REPLIES 18

venkatiyer1
Giga Guru

I see from your code that you are making the ajax call post the list refresh. You can run the above function on the response of ajax call. Let me know if that works. Or if that doest work pls post the recent changed code.


Yes, I have tried that approach too, refreshing with in the response, still the same issue. Below is the edited code:



function onClickFunctionName() {


  var selSysIds = g_list.getChecked();



  var ga = new GlideAjax('scriptName');


  ga.addParam('sysparm_name', 'funName');


  ga.addParam('sysparm_sys_id', selSysIds);


  ga.addParam('sysparm_show_msg', false);


  ga.getXMLAnswer(function(response){


          GlideList2.get("tableName").setFilterAndRefresh("");


            addFormMessage(response, "info", 0);


  });


}


venkatiyer1
Giga Guru

Hi Medha,



I am not aware of any handle that glist provides for a callback after refresh. Essentially it refreshes the frame itself. So one way to do is to reload the frame instead of refreshing the list and add a onload event using addLoadEvent function and call the addFormMessage.


venkatiyer1
Giga Guru

A handy page is given below. So in your ajax response you can call the dialog window.




https://www.servicenowguru.com/system-ui/glidedialogwindow-advanced-popups-ui-pages/