Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

how to display an alert message from the server script ??

shrinandhini
Kilo Contributor

i wrote a business rule script and i want an alert to be displayed once the condition is true. this is my script

if((!current.start_date.nil())&&(!current.end_date.nil()))

{

  var

startdate = current.start_date.getGlideObject().getNumericValue();

  var

enddate = current.end_date.getGlideObject().getNumericValue();

  if

(startdate > enddate) {

      gs.addInfoMessage('start must be before end date'); // i should not use this or error message please help me out

      current.setAbortAction(true);

  }

}

2 REPLIES 2

Rodrigo Higa
Kilo Guru

Hi Shrinandhini,



Since a Business Rule runs server side, I do not believe the alert function will work as you want, as this function is processed on client side. Maybe it's possible in a complex way..



From server side, the only way I know to warning messages are through GlideSystem calls [gs.addInfoMessage() or gs.addErrorMessage()].



Otherwise, if you really want some kind of popup message window, maybe you could try to use this script validation in a Client Script, UI Action or UI Policy, which are processed on client side.



Cheers,


Rodrigo Higa


yeah thanku !!!