Duration field formatted

Catalin2
Kilo Contributor

It's any way to customize the appearance of glide_duration field type?.

By default it display as label only Days and Hours.

It's any way to display "Minutes" or "Min" as well?.

Thank you.

6 REPLIES 6

Chuck Tomasi
Tera Patron

Hi Catalin,



The duration field shows days on one line, hours/minutes/seconds on the second line.



find_real_file.png



There are no current configuration options for this specific field type.


Hi Thomas,



Thank you for response.


However, I have a customer requirement   for this behavior :


1. Field is displayed normal (in Hours format)


2. After the completion, the field should be read only


3. The read only field should looks like in picture below


find_real_file.png



It's any way to display a label or a dummy field or a text box in exactly the same position as duration field? (after make it read only and probably hide).


I can do it with Javascript DOM or jQuery, but I want to avoid this, because the HTML source can be different in future versions of ServiceNow.



Thank you,



Catalin.


I discovered that if I make the field read-only with a UI policy, the details remain intact. Would this work?



find_real_file.png


Actually no. The customer wants exactly that type of formatting, which is possible only in string field.



I still looked after a solution to put a simple text box that are not associated with database field .



Until then, the simplest(and easiest)   idea is to have another field, custom one, string type, with the same label. (a text box will be enough).


Then I wrote a business rule (on duration field, on change, before update) that format that string field in human format :



find_real_file.png



Then, I wrote a client script, on load. I check if duration field is not read only, then string field is hidden and duration field is visible. If duration field is read only,   then duration field is hidden and string field is visible .



Even implies new fields, this solution does not involve jQuery or DOM, so future update will not affect the functionality.



Thank you and best regards,



Catalin.