Alert the user on specific dates.

tsoct
Tera Guru

There is a list of dates where the user should include in their chosen time frame. How can I alert the user if the time range they've selected contains these dates?

 

Ex date that should not be included:

*** Script: "2024-07-17"
*** Script: "2024-07-18"
*** Script: "2024-07-19"
*** Script: "2024-07-20"

 

If user select u_start_date = 2024-07-16 ; u_end_date = 2024-07-21, user should be alert to exclude 17/18/19

2 REPLIES 2

Mark Manders
Mega Patron

Where are you applying this? In the backend or on the portal?

It should work with a client script, but you mention that you have a list of dates. Is that a list in ServiceNow, so you can reference it? If not, you will need to validate each separate date in the client script, to show an alert on selecting this date (and maybe even empty the field).


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Hello @Mark Manders 

 

These are all the variables on catalog item.

 

Variable 1 = Date with value like: "2024-07-17""2024-07-18""2024-07-19""2024-07-20"

Variable 2 = Start Date

Variable 3 = End Date

 

The idea is to alert the user if the selected range between the start and end date contains any of the dates in Variable 1.