We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to make the date field default to the current date?

Ricardo Sanche3
Tera Contributor

How can i default the date field to the current date and also they cant select past dates? Catalog item.

 

Date.JPGDate Variable.JPG

1 ACCEPTED SOLUTION

Saurabh Gupta
Kilo Patron

Hi,

This can done by setting up default value gs.now() and with very simple ui policy.

 

UI Policy Condition

SaurabhGupta_0-1672261229302.png

 

UI Policy Execute if true

SaurabhGupta_1-1672261268587.png

 

Default value

SaurabhGupta_2-1672261294028.png

 

 

 

 

 

 

 

 


Thanks and Regards,

Saurabh Gupta

View solution in original post

2 REPLIES 2

EricDohr
ServiceNow Employee

Under default value, try out below

javascript: new GlideDateTime().getDate()

Saurabh Gupta
Kilo Patron

Hi,

This can done by setting up default value gs.now() and with very simple ui policy.

 

UI Policy Condition

SaurabhGupta_0-1672261229302.png

 

UI Policy Execute if true

SaurabhGupta_1-1672261268587.png

 

Default value

SaurabhGupta_2-1672261294028.png

 

 

 

 

 

 

 

 


Thanks and Regards,

Saurabh Gupta