Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Function Flushmessage not working in Custom scope

kailashthiyagar
Kilo Guru

I m using Flushmessage in Business rule to remove the error message which i added on the form. But i m getting an error message as "Function flushMessages is not allowed in scope x_opt_"

Could someone help me with alternate approach... Should i be using client script/script include to provide an error message or any other options?

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

You are correct. gs.flushMessages() is not available in scoped apps. Have you considered using g_form.clearMessages() from a client script?



https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=r_GS-flushMessages



If you feel this is a critical method to use in scoped apps, I invite you to open an enhancement request! Our product managers DO listen.


Enhancement requests: Tell us how you would improve the ServiceNow product


View solution in original post

4 REPLIES 4

Chandu Telu
Tera Guru

Can you share the the code



i think flushMessages is function which is not allowed in scoped application


Chuck Tomasi
Tera Patron

You are correct. gs.flushMessages() is not available in scoped apps. Have you considered using g_form.clearMessages() from a client script?



https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=r_GS-flushMessages



If you feel this is a critical method to use in scoped apps, I invite you to open an enhancement request! Our product managers DO listen.


Enhancement requests: Tell us how you would improve the ServiceNow product


Thanks ctomasi


g_form.clearMessages() doesn't seem to work in Service Portal. Do we have any alternate method to clear messages shown on top of the page using g_form.addErrorMessage() and g_form.addInfoMessage()?