Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

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