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.

The date of entry field must accept only current date (as per system date) and not past or future da

shirisha yadav
Tera Contributor
 
1 ACCEPTED SOLUTION

Eshwar Reddy
Kilo Sage

Hi @shirisha yadav 

Create On Before BR

var gdt = new GlideDateTime();

var todayStr = gdt.getLocalDate().toString();

 if (current.date_of_entry.toString() !== todayStr)

{

current.date_of_entry = todayStr;

 gs.addErrorMessage('The date of entry must be the current date.');

current.setAbortAction(true);

}

Please mark this response as Correct and Helpful if it helps you can mark more that one reply as accepted solution

View solution in original post

2 REPLIES 2

Eshwar Reddy
Kilo Sage

Hi @shirisha yadav 

Create On Before BR

var gdt = new GlideDateTime();

var todayStr = gdt.getLocalDate().toString();

 if (current.date_of_entry.toString() !== todayStr)

{

current.date_of_entry = todayStr;

 gs.addErrorMessage('The date of entry must be the current date.');

current.setAbortAction(true);

}

Please mark this response as Correct and Helpful if it helps you can mark more that one reply as accepted solution

need to change in email script