We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to trigger the 'Leave Page' 'Changes will be lost' message on new Widget

PavelP
Mega Sage
Hello,
I have a tricky question - I have a requirement to show the "Leave Page" message, when the user tries to click from updated custom widget without saving, via breadcrumbs or the back button.
PavelP_1-1702630692956.png

 

We know it's possible because it works on the standard Cat Item widget, but there is only the following mention of the "Leave page" message - no mention of how is it triggered.

 


<now-message key="Changes you made will be lost." value="${Changes you made will be lost.}" />
<now-message key="Leave page?" value="${Leave page?}" />


I'd assume it was something in Client Script, but I'm really not sure what to look for. Any hints on what could be the trigger, so we can recreate it?

Thanks
0 REPLIES 0