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.

Set Error Message within Business Rules

kiley
Giga Contributor

So for my current project, I need to set an error message on a planned start date field or planned end date field if they are outside the parameters set. I have everything working fine, meaning my conditions are all correct, but I cannot figure out how to get the error message to appear. Here is the code:

current.u_planned_end_date.setError("Please change the above date");

current.u_planned_start_date.setError("Please change the above date");



the names are correct (u_planned_etc.), for they worked in other code used inside the same rule, and I tried using "gs" instead of "current" just in case that was an option and it still did not work. Any ideas?

Thank you in advance!

Update: I found that code through the wiki page Scripting Alert, Info, and Error Messages - ServiceNow Wiki

1 ACCEPTED SOLUTION

5 REPLIES 5

kiley
Giga Contributor

thank you very much! I did not have current.setAbortAction(true); in my script!