how to add info or error message in a Workspace list view

Serghei Tolstov
Tera Contributor

We have a Workspace template (CSM) which is read only in UI Builder, and i created a Button on the list view, which performs some changes to selected record.
BG of the button logic: 
I achieve it by creating Action Assignment (Implemented as a Client script), added this action to List of Action of UX Actions Configuration, and utilized g_list.getChecked() with Ajax for record update (client scripting). 

So we have functioning button, we just need to add success/info/error message to show results of this action.
g_form[method] is not available in this environment, gs[method] from Ajax not affecting UX/UI of Workspaces, g_list seems to not have this message functionality, and template is read only (cant add/edit in UI Builder)  
Solution with modal or alert popup is not desirable. 

The OOB  Edit button in work space has this functionality, it shows success message after updating records, but i couldn't figure out where is the scripting of this button to copy solution from.
Screenshot 2024-09-03 at 19.00.39.png
Any thoughts ?

 
 
 
1 ACCEPTED SOLUTION

Casper6060
Mega Sage

Ok i belive i found a solution for you 🙂 Spent quite a few hours looking at this, kinda annoyed me that it was not possible, but this workaround should hopefully be enough.

 

What i did was create a script include called ListMessageHandler which can then call gs.addInfoMessage and then upon returning to the client script, refresh the related list, this will cause the message to appear.

 

Script Include:

Casper6060_0-1725735614228.png

 

Client Script:

Casper6060_1-1725735638997.png

 

Result:

Casper6060_2-1725735660249.png

 

 

 

View solution in original post

6 REPLIES 6

Thats very interesting, because i remember i tried and it didnt show in Workspace (it did show in logs instead, i guess i did messed up somewhere else).
in a mid time i was trying to figure out how to dispatch event for <now-alert> from client script 
(https://developer.servicenow.com/dev.do#!/reference/next-experience/sandiego/now-components/now-aler...)

But your solution works in my case, Thanks!  

 
 
 

What is the Client script here, I didn't see the client script page like above screen shot.
Generally when I open open Client script, we can some field types and field name and Etc.,

Can you help me on this.

My Requirement is : In the List view when the status field is changes to Close with Action field is empty then we show the Error message.
In the related list I got, but in list view not.