Set Time Field to Empty by default

Brandon Warren
Kilo Guru

I've created a custom table "Operations Turn-Over" to track times of nightly critical jobs that my company runs. The operators monitoring the jobs are expected to fill in the completion times as the jobs finish. Unfortunately, the times default to 12:00 and I can't find a way to leave these empty. This causes an issue when looking at the record from a list view as it makes it look like any unfinished jobs were completed at 12:00. Is there a way to default the "Time" field to empty in both the list and record view?

 

Thanks in advance!

 

find_real_file.png

 

 

find_real_file.png

4 REPLIES 4

Jeff Currier
ServiceNow Employee
ServiceNow Employee

I actually thought blank was the default.  What do you have as the default on your table column definition?  You form show four fields, a date and three times,  Are these all different variables?  Do they all default to empty?  What is their data type?  is it Date/time or other?

 

I was looking at the change form as an example, and planned start date is empty by default.

Thanks for the quick reply Jeff,

The first field "Date" is just a Date field, not a Date/Time. I'm having no issues with its functionality at this time. The other 3 fields are "Time" fields. I haven't set any defaults on them and looking at their dictionary entries, the default value is empty. However, when opening the form to add a new record, the time fields auto-populate as 12:00 AM as shown above. If I blank out the values and save the record, it just switches them back to 12:00 AM. I need them to show as an empty field by default and only display a value if one is manually entered.

 

I played with this some and could not come up with a great resolution.  Using it as is, isn't too bad ad clearly it couldn't finish as 12am.  You could change the format to 24 hour time, so it would show as 00:00:00, but this isn't blank.

If you use date time for those fields they can be blank, but the would need to pick the day too. You could default the day based on your first field to make it easier.

I also experimented with the duration type.  This is days, hours, min and the display looks OK, but not exactly what you want

The challenge with the time type is that it is really a time for a specific day "1970-01-01" which does not have daylight savings applied.  Since it pre-pends and hides that day, it must have some hour to go with it.  It is ultimately a datatime field, just a special version of it.

This is how 24 hour time format looks for this.  Field 1 is date, field 2 is time, field3 is datetime

find_real_file.png