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

There is not easier way other than GlideDialogWindow.



GlideDialogWindow API Reference - ServiceNow Wiki


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


Thanks Venkat, that works perfect for displaying message on UI, that solves half of my problem. The other issue is, I need to refresh the g_list manually after the list choice ui action is clicked. When I do this before or after the ajax call, the info message vanishes. Any pointers how I can solve the refresh the message display?


Hello sir i am not sure why this isn't working for me



ga.getXMLAnswer(function(response){


  addFormMessage(response,'info',0);


  });



It saying Uncaught ReferenceError: addFormMessage is not defined any ideas?


Hi Alexander,



Which version of ServiceNow are you in? In helsinki, i do see the function name has been changed to _addFormMessage. You can try addInfoMessage(response, 0) instead.