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.

Date/Time Field Restriction Record Producer

Sam Ogden
Tera Guru

Hi All,

I have a date/time field on a record producer asking when the incident first occurred.

I have seen that the only way yo restrict this so people cannot add a date in the future is to have a script which validates this between the current date and the date selected when the field changes and then have a pop up message to warn the user.

I'm just not sure on how to script this?

Any help is greatly appreciated.

Thanks

37 REPLIES 37

Hi Shloke,



In the system log getting the following:


find_real_file.png


Hi,



OK. This script Include defined above will work in Global Application Scope. So just wanted to confirm are you working/testing this in an Custom application Scope or in an Global Application Scope and can you search the Logs by navigating to Script Log Statements module and search with Filter as Message contains "Value of res is"?



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hi Shloke,



The record producer is on the portal and sits under the Customer Service Application.


When I search on the Script Log Statements, for "Value of res is" I get no results



Thanks


Hi Sam,



Ok. Thanks for your response. Can you please change the Accessible From field value to "All Application Scope" and try your script again as shown below:



find_real_file.png



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hi Shloke,



I'm still not seeing anything when select a future date and again nothing in the   Script Log Statements, for "Value of res is".



below is how my script is currently set.


find_real_file.png


find_real_file.png


find_real_file.png



find_real_file.png