Show only days in duration field.

kshitij patil
Mega Contributor

Hello All,

I want to make only days  from the duration field to be visible and hide the hours min and second.

 

As shown in below screenshot I want to hide highlighted field.

find_real_file.png

Can anybody help here.

Thanks in advance,

_kP

13 REPLIES 13

Below code helped us:

function onload{

var a = document.getElementsByClassName('col-xs-7 col-sm-12 col-md-12 col-lg-8 no-left-padding-lg');

a[0].style.display='none';

a[1].style.display='none';

}

 

you can increment the value based on number of duration field on the form.

This logic is not working tushar any idea

Tushar Sharma2
Kilo Guru

Hello KP,

I have checked with max_unit=days and its seems that attribute will not work with Days. To achieve this you need to write below onload client script. You just need to Replace TABLE_NAME with your table name(for eg: 'u_test') and FEILD_NAME with your duration field name (for eg : 'u_duration_field').

function onLoad() {
 
g_form.getElement('ni.TABLE_NAME.FIELD_NAMEdur_hour').style.display='none';
g_form.getElement('ni.TABLE_NAME.FIELD_NAMEdur_sec').style.display='none';
g_form.getElement('ni.TABLE_NAME.FIELD_NAMEdur_min').style.display='none';


}

 

Hit Helpful or Correct on the impact of response.

Regards,
Tushar
www.DxSherpa.com

Thomas Wright1
Tera Contributor

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

https://community.servicenow.com/community?id=view_idea&sysparm_idea_id=353bc6a31bea8910c790ece6b04b...