How to limit the date choice in a date field

Moacir Junior
Tera Contributor

I need to manipulate two date fields for the following action:

Allow date filling from 1 month before the date of the request.
Example: opening in March, you can fill in the date from February onwards.
The two fields are within an MRVS and
the current reference date will be the current system date.

I would like a suggestion on how to carry out this action.

3 ACCEPTED SOLUTIONS

Dr Atul G- LNG
Tera Patron
Tera Patron

Try UI policy with relative operator. with before / After and ago and from now. @Moacir Junior 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

Anurag Tripathi
Mega Patron
Mega Patron

You will need to let the user select what they want , and then validate and clear the value if it doesnt meet the criteria

Solved: selected date should not be greater than 30days - ServiceNow Community

-Anurag

View solution in original post

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @Moacir Junior 

 

You can simply create a UI policy for the date variable in MRVS as like below.

 

1. Your date of request will be same date on which the record or request is being submited.

2. so do like below:

UI Poilcy condtion > 'State date' is relative  30 days before 'created on'

UI Policy action > Clear field value 'start date'.

Add a message g_addFieldMessage('start_date', error, 'your message ');  // 'please select the date in past 30 days...'


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

View solution in original post

6 REPLIES 6

Dr Atul G- LNG
Tera Patron
Tera Patron

Try UI policy with relative operator. with before / After and ago and from now. @Moacir Junior 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Thanks! worked perfectly

Anurag Tripathi
Mega Patron
Mega Patron

You will need to let the user select what they want , and then validate and clear the value if it doesnt meet the criteria

Solved: selected date should not be greater than 30days - ServiceNow Community

-Anurag

Thanks! for the help