only allow the current day and the following day to be selected. All other days should not be allow

SivaKumar123
Tera Contributor

Only allow the current day and the following day to be selected. All other days should not be allowed.

Date variable should be allowed only select either today or tomorrow.

1 ACCEPTED SOLUTION

Glad to know my response helped.

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

View solution in original post

5 REPLIES 5

Harshal Aditya
Mega Sage
Mega Sage

Hi @SivaKumar123 ,

 

Please refer the link below

https://www.servicenow.com/community/developer-articles/date-validations-client-scripts/ta-p/2298860

 

Please mark this response as correct or helpful if it assisted you with your question.

Regards,
Harshal

sourav1999
Mega Guru

- Use the 'min' and 'max' attributes to limit the date range of the date picker

- Set the 'min' attribute to the current date and the 'max' attribute to the following day

- Make sure the 'min' and 'max' attributes are formatted correctly in the 'yyyy-mm-dd' format

- Use the 'read-only' attribute to prevent users from manually entering dates outside of the specified range

 

For asking ServiceNow-related questions try this :

For a good and optimistic result, please visit this website. It uses a Chat Generative Pre-Trained Transformer ( GPT ) technology for solving ServiceNow-related issues.

Link - https://nowgpt.ai/

 

For the ServiceNow Certified System Administrator exams try this :

https://www.udemy.com/course/servicenow-csa-admin-certification-exam-2023/?couponCode=NOW-DEVELOPER

Voona Rohila
Kilo Patron
Kilo Patron

Hi @SivaKumar123 

You can simply do it with UI policy with no code 

Sample : ( modify the conditions accordingly)

VoonaRohila_0-1684419218342.png

VoonaRohila_1-1684419522904.png

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Hi Voona,

 

Its working after change the filter condition 

Start date before today OR start date after tomorrow condition.

and

function Oncondition()

{

Alert('Date variable should be allowed only select either today or tomorrow');

g_form.clearValue('start_date');

}

 

Thanks everyone for helping me