how to add Info Message to List Action Assignment in Workspace

Alon Grod
Tera Expert

Hi,

This is my List Action Assignment, the functionality is working find but im trying add g_from.addInfoMessage('hi') but nothing is happening.
How can I add info message so it will be visible to the user in List view.

AlonGrod_0-1767264772403.png

function onClick() {

    var checkedRecords = g_list.getChecked();
	//gs.addInfoMessage('hi');
	//g_form.addInfoMessage('tttt');
    var ga = new GlideAjax('WmTaskBatchPdfExporter');
    ga.addParam('sysparm_name', 'isPdf'); // Setting input
    ga.addParam('sysparm_sys', checkedRecords);

    ga.getXML(ajaxCallback);
}

function ajaxCallback(response) {
    var answer = response.responseXML.documentElement.getAttribute("answer");
    if (answer) {
		
		top.location.href = answer;
       
    }
}

 

13 REPLIES 13

Aswin S
Tera Contributor

Hi,

g_form.addInfoMessage() works only on form views, so it won’t display anything in a List Action.

To show a message in List view:

  • If the List Action is server-side, use:

    gs.addInfoMessage('Hi');

    This will display the message at the top of the list.

  • If it’s a client-side List Action, g_form is not available—use an alert() or call a server-side script to return a message.

This is expected behavior in ServiceNow.

Ankur Bawiskar
Tera Patron

@Alon Grod 

I don't think it's going to work in workspace list action

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Tejas Adhalrao
Tera Guru

Hi @Alon Grod ,

 

g_form.addInfoMessage('hi');  this will work only on the forms

List Action  - which runs in a list context

gs.addInfoMessage() - this use server side .

 

 

workaround : you can create the UI action.(LIST) . using that UI action you can show the message and easily pass the client side data to server side. and display info message 

 

also you can try this but i tried this it was not working 

https://www.linkedin.com/posts/payaltyagi7788_servicenow-glideui-listviewtips-activity-7340069228944...

adityahubli
Tera Guru

Hello @Alon Grod ,

If my response helps you then mark it as helpful and accept as solution.

Regards,

Aditya,

Technical consultant

Alon Grod
Tera Expert

@adityahubli @Tejas Adhalrao @Ankur Bawiskar @Aswin S @Mohammed8 

Hi im trying to using gs.addInfoMessage but it does not work. Maybe I Need to use glide modal? if so how?

Im calling a script include that return an answer back to the client