- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2020 11:38 PM
I need to add a field on a table..with format "Days:Hours:Minutes" it needs to fill as per the format...how to do it? can anyone suggest me
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2020 01:25 AM
Hi,
updated below should work
function onLoad(){
var fieldName = 'u_downtime';
document.getElementById('ni.' + g_form.getTableName() + '.' + fieldName+ 'dur_sec').style.display = 'none';
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2020 11:41 PM
HEllo,
Refer,
If answer is helpful please mark correct and helpful!
Thanks,
Pratiksha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2020 11:43 PM
Hi,
Kindly use the duration field type. Refer to this link for other types as well.
Mark the comment as a correct answer and helpful if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2020 11:43 PM
you can use field type "Duration" but it would come with
Days:Hours:Minutes and Seconds also
No other option
So one way is to hide the seconds box for this field type
But that would require DOM manipulation which is not recommended
If you still require then create onLoad client script
Ensure Isolate Script field is set to false; This field is not on form but from list you can set it with false.
function onLoad(){
var fieldName = 'your field name here';
document.getElementById('ni.' + g_form.getTableName() + '.' + fieldName + 'dur_sec').style.display = 'none';
}
Output: It hides the seconds box
Note: users can still edit for the seconds from list
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2020 12:36 AM
Thanks for the update, but client script is not working..
and I have set to false from the list[isolate script] eventhough its not working...
in place of fieldname I have used "coumnname[backend name]" and confirmed name is correct..
and used alert for verification..even alert was not came