The CreatorCon Call for Content is officially open! Get started here.

Date time field cannot be in future

FotinaG
Tera Contributor

Hi Team,

 

In var set I have Date time field , however i need to make it unpossible to choose date in future and show an info that  date cannot be in future in 2 languages depending on what user session is.

I tried with Client script into car set and separately in item, also with UI policy, but still behavior is not changing. It had to be easy task, but I cant achieve the goal. Is it an issue that this variable is in var set? 

Could you please help me to find an easy solution?

 

Thank you

Tina

2 ACCEPTED SOLUTIONS

@FotinaG , 

CC : @GlideFather 

 

It should work, if you write client script on variable set too.

Refer below screenshots.

Screenshot (22).png

 

Screenshot (24).png

If this works, please mark it as helpful/accepted — it keeps me motivated and helps others find solutions.
Shashank Jain

View solution in original post

@FotinaG 

you can achieve this without scripting and simply use UI policy

Restrict user for selecting future dates in Service Catalogue. 

Reference from above: You can write a simple UI Policy as show below:

AnkurBawiskar_0-1755161389403.png

 

AnkurBawiskar_1-1755161389364.png

 


Output will be as shown below:

AnkurBawiskar_2-1755161389379.png

 

 

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

20 REPLIES 20

@FotinaG , 

CC : @GlideFather 

 

It should work, if you write client script on variable set too.

Refer below screenshots.

Screenshot (22).png

 

Screenshot (24).png

If this works, please mark it as helpful/accepted — it keeps me motivated and helps others find solutions.
Shashank Jain

@FotinaG , 

 

OnChange client script should also work for this.

 

As per new community feature you can mark multiple responses as correct.

If this helps, please consider marking my answer as accepted — it motivates me to stay active in the community and also helps others find relevant solutions more easily.

@Ankur Bawiskar , Nice to know, we can achieve this by using UI policies too.

 

Thank you!

 

 

If this works, please mark it as helpful/accepted — it keeps me motivated and helps others find solutions.
Shashank Jain

Thank you for Client Script option, it was really helpful!

@FotinaG 

you can achieve this without scripting and simply use UI policy

Restrict user for selecting future dates in Service Catalogue. 

Reference from above: You can write a simple UI Policy as show below:

AnkurBawiskar_0-1755161389403.png

 

AnkurBawiskar_1-1755161389364.png

 


Output will be as shown below:

AnkurBawiskar_2-1755161389379.png

 

 

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thank you so much, it worked perfectly!