Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

how to convert int field type to display hour format

Balakrishna_ABK
Tera Guru

Akhil7842_0-1706957369773.png

how to convert int field type to display hour format
currently Iam using format_glide_duration which is showing Day-time format

2 REPLIES 2

Anand Kumar P
Tera Patron

Hi @Balakrishna_ABK ,

 

https://docs.servicenow.com/bundle/washingtondc-platform-administration/page/administer/data-diction...

If above one not working Insted changing the field data type write script to change integer value to duration.

 

var catItem = current.cat_item.getRefRecord();

var durationSelected = parseInt(current.variables.estimated_duration);
if(current.variables.unit == 'Hours'){
var hourConversion = parseInt(durationSelected*60*60*1000);

catItem.durationField.setDateNumericValue(hourConversion);

catItem.update();

 

Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand

Hi @Anand Kumar P @ can we do it by changing attribute?