How to get only time field on record producer?

JMR2
Mega Expert

Dear All,

In ServiceNow form level there is a time field, how can I get time field on the record producer?
How can we do it from UI macro?
 
Please suggest.
 
Thanks
12 REPLIES 12

Harsh Vardhan
Giga Patron

assuming you are talking about timer field , if yes ootb its only available for form. 

 

if you want to use it as variable then you have to write html code in ui macro and then use ui macro type variable over your record producer. 

 

timer type html example 

 

https://www.sitepoint.com/build-javascript-countdown-timer-no-dependencies/

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

in UI macro you can use 

<g:ui_date_time id= "${jvar_name}" value= "${jvar_name}" />

 

What about record producer?


Thanks,
Ashutosh

Ash10Patil
Kilo Guru

Hi,

 

You can create field of type Duration and create onload client script to hide day part using DOM manipulation as below:

getDocument().getElementsByClassName(<Day part field>)[0].style.display='none';

You can get Days portion of Duration field by inspecting element shown as below:

find_real_file.png

 

UI script: Set as global 

Add script as:

function getDocument()
{
return document;
}

 

 

Thanks.