The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Is there a way to open date/time picker using a UI macro button ?

shubhampatel
Kilo Contributor

I want to set the date/time value to a read only field which stores string values.

Thanks,

Shubham Patel

7 REPLIES 7

chirag_bagdai
ServiceNow Employee
ServiceNow Employee

Hi Shubham,



Can you elaborate ? If possible, can you share screenshot ?


chirag_bagdai
ServiceNow Employee
ServiceNow Employee

Hi Shubham,



Please find below JavaScript code to open/close date picker field.



var field_id = g_form.getControl('start_date').name;


new GwtDateTimePicker(field_id, 'yyyy-MM-dd HH:mm:ss', true);


find_real_file.png


find_real_file.png



I want to open a date/time picker by clicking the ui macro and store the date value in the field


Hi Shubham,



Is there any reason for not using "Date/Time" Field and instead creating custom date field ?



You could create new field in the form and use that whenever you need.