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

Casper6060
Mega Sage

An Action Assigment implemented as Client Script works fine for me:

Casper6060_0-1725659724753.png

My action is set up as a related list action, but i dont think that has anything to do with it.

From what i can see, the intelisense does not show g_form to be usable, but using it like this: 

g_form.addInfoMessage('This is Test'); seems to work just fine?

I know it's not a success message so to speak, but it should still be fine.

Thank you for the reply, but unfortunately that's not working for List view (unlike Related list)
"Complete" button in a list view :
Screenshot 2024-09-06 at 21.39.21.png


result onClick:
Screenshot 2024-09-06 at 21.10.50.png


Button setup:
Screenshot 2024-09-06 at 21.55.50.pngScreenshot 2024-09-06 at 21.31.14.png
 
 
 

Casper6060
Mega Sage

**bleep**, thats a shame. Looking at the GlideList documentation for the now experience, i only see them using alert in their example.

https://docs.servicenow.com/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/Glid...

So this might be the only way to do things for the moment

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