Hide seconds on a duration field

mkader
Kilo Guru

Hello,

I am trying to find the best way to hide seconds from a duration field that we have. I am using something from another community post I found earlier. I was advised by a member on my team to modify the attributes on the field. How can I do that through an attribute?

This is what I have to currently hide the seconds and it works, but there is a temporarily glimpse at the seconds field while the page is loading:

function onLoad() {
    g_form.getElement('ni.pm_project.effortdur_sec').style.display='none';
}

Thanks!

1 ACCEPTED SOLUTION

Absolutely highly NOT recommended, for instance refer to the following official article:

https://hi.service-now.com/kb_view.do?sysparm_article=KB0692555

If I have answered your question, please mark my response as correct and helpful.

Thank you very much

Cheers
Alberto

View solution in original post

11 REPLIES 11

Exactly, use their suggestion only in case you really need it.

In my view, I would always push back this kind of requirement, but that's my personal view.

@mkader 

Did this solve your question? Or do we need to follow-up on this?

If I have answered your question, please mark my response as correct and helpful.

Thank you very much

Cheers
Alberto

Sorry for the delay. I was on PTO. Yes it did solve my problem thanks again!

Willem
Giga Sage
Giga Sage

DOM manipulation will take time to load/work, so that is the temporarily glimpse you are experiencing.

 

Your script is one option out of two options provided here:

https://community.servicenow.com/community?id=community_question&sys_id=cc77e1f6db6ceb401cd8a345ca96...

You can do this by two ways:

1. DOM manipulation

2. Changing the system property - Go to System Properties > System > Time Format and knocked off the :ss  (seconds) and it will remove the SS part from your field but it will affect all fields of Time format within the system as this is Global change.

 

DOM manipulation is not recommended. Consider how important the requirement is and if it is needed.

Thank you for your response. I tried that earlier with the system property. it did not seem to remove the seconds field from any of my duration fields:

find_real_file.png find_real_file.png

I also tried to log off and log back on and same results. Second field was still displaying