date variable

abhisek
Tera Contributor

Hi All,

I have a date variable 'xyz' which value is getting auto populated based on other 2 variable's values but still not read only. When the value of the date variable 'xyz' is not empty then I need to restrict the user to select any date which is greater than the current value of that date variable xyz that means user can select any date till the date which is already getting auto populating but not greater than that. 

I want to do it using on change client script.

 

Can you please help me out.

Thanks in advance.

 

Regards,

Abhisek Chattaraj.

 

 

 

15 REPLIES 15

Ankur Bawiskar
Tera Patron
Tera Patron

@abhisek  

then you will require 1 more hidden variable to store the auto populated date

Then you can use onChange client script and compare the date which user gives against this hidden date value

1) have another date variable on form towards the end and hide it using UI policy

2) then using Ajax set both the date variables

3) then create onChange client script to compare both the dates

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

Hi @Ankur Bawiskar 

Thanks for your reply.

I am not allowed to create another hidden variable.

 

Thanks&Regards,

Abhisek Chattaraj.

@abhisek  

I don't think any other way other than hidden variable.

then the only way is to use onchange + GlideAjax and validate everytime and don't auto populate.

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

Hi @Ankur Bawiskar 

Thanks for your reply.

I have tried with this but the problem is when the date variable xyz is getting auto populated with the greater date then also it is throwing the error message and setting it to the old auto populate date value.

 

Regards,

Abhisek Chattaraj.