How to print value of a Duration type field. I am trying to print "Business time left" in the SLA

EKTA2
Tera Expert

 

Hi. I need to print "Business time left" in SLA.  It is a "Duration" type field. I have tried GlideDateTime API and all other general mediums, however, no luck. Can someone please advise. 

 

EKTA2_1-1675928565574.png

 

var task_sla_gr = new GlideRecord("task_sla");
task_sla_gr.addQuery("task", current.number);
task_sla_gr.query;
if(task_sla_gr.next){
var tim = task_sla_gr.getValue("business_time_left"));  // getting undefined/ null 

}

 

1 ACCEPTED SOLUTION

newhand
Mega Sage

@EKTA2 

task_sla_gr.next()

 

 

Please mark my answer as correct and helpful based on Impact.

View solution in original post

2 REPLIES 2

newhand
Mega Sage

@EKTA2 

task_sla_gr.next()

 

 

Please mark my answer as correct and helpful based on Impact.

Johns Marokky
Tera Guru

Hi @EKTA2 ,

I think you need to change the code a little bit. try the below code and see if it works.

var task_sla_gr = new GlideRecord("task_sla");
task_sla_gr.addQuery("task.number", current.number);
task_sla_gr.query();
while(task_sla_gr.next()){                    //I had used while because there will be more than one SLA. Use addQuery if you need to add more filter
var tim = task_sla_gr.business_time_left.getDisplayValue();
}

Mark Helpful and correct if it helps in Solving your query.

 

Regards,

Johns