For Duration field, how to show only days?

RatneshTSN
Giga Guru

For Duration field, how to show only days?

I have tried as per documentation:

https://docs.servicenow.com/bundle/kingston-application-development/page/script/general-scripting/co...

But its not showing

Its not working for days, for minutes its working

To show only days, how its achievable , can anyone point out...

Attribute set for minutes

find_real_file.png

 

 

Duration field converted to Minutes

find_real_file.png

Attribute set for days

find_real_file.png

 

 

But its not showing only days:

find_real_file.png

 

 

9 REPLIES 9

Giving some life to this old topic 🙂
Is there an available option now to show only the days in in the Duration field?

I tried with the client script, but it looks quite ugly on the form...
find_real_file.png

I tried with attributes as well, but they don't work my way unrotunately.

I have no idea.  If the content in this thread doenst work, I'd start a new one and also open a HI ticket.  

Thanks for checking, will do.

Tushar Sharma2
Kilo Guru

Hello Ratnesh,

Try below code on On-load client Script for duration field to hide hours, min and sec:

function onLoad() 
{
document.getElementsByClassName('col-xs-7 col-sm-12 col-md-12 col-lg-8 no-left-padding-lg')[0].style.display='none';
}

If you noticed in below code there is an array index number which will specify the index of duration field. In case of multiple duration field you need to specify the index number.


document.getElementsByClassName('col-xs-7 col-sm-12 col-md-12 col-lg-8 no-left-padding-lg')[0].style.display='none';

 

find_real_file.png

Register Now

www.DxSherpa.com

 

Thomas Wright1
Tera Contributor

I have submitted an idea for this feature, if you'd like to upvote:

https://support.servicenow.com/ideas?id=view_idea&sysparm_idea_id=353bc6a31bea8910c790ece6b04bcb82&s...