How do I get Business elapsed time duration in custom field on ticket form

Rakesh50
Mega Sage

Hi,

We have a requirement to get the Business elapsed time(task_sla) value in Response field in sc_req_item form. Here Response field is string type field and we need only hrs and minutes value from Business elapsed time. So we have used calculated value and we called the script include function and working fine now. But form is opening a bit slowly and even for listview also getting active transitions message. 

I tried using before business rule but response field value not changing even after Business elapsed time value changes in task_sla for respective ticket. Can anyone suggest us the best approach and check the code which we have written

 

Calculated value:-    
 var response = new requestResponse().SLAResponse(current);
 return response;
SLAResponse:-
SLAResponse: function(record){
var recordId = record.sys_id.toString();
var allsla = new GlideRecord('task_sla');
allsla.addQuery('task', recordId);
allsla.addEncodedQuery('sla=de900e9c879e3910bd97fdd5dabb3576');	
allsla.query();
while (allsla.next()) {
   var durationParts = allsla.business_duration;     //business_duration;
var timePart = durationParts.split(' ')[1]; // Extracting the time part
var timeParts = timePart.split(':');
var hours = parseInt(timeParts[0]); // Extracting the hours part
var minutes = parseInt(timeParts[1]); // Extracting the minutes part
var responseTime = hours + ' hrs ' + minutes + ' minutes';
   return responseTime;
}	
	},

 

 

4 REPLIES 4

Jaspal Singh
Mega Patron
Mega Patron

Hi Rakesh,

 

Why not create a report on task_sla table and then dot-walk to get relevant fields of RITM?

Also, I assume the BR is on task_sla table which runs when Business Elapsed Time changes. Suggestion is to make the BR after insert/update.

Hi Jaspal,

Thanks for the response. They want to check at what time fulfiller was responded on the ticket. If the SLA is 12 hrs they want to see at what time he responded on reports. We have a 3 custom fields on ticket Response field(string)  Response sent (true/false) and ongoing response(string). We have 2 types of sla's first response and ongoing response sla's. They need only hrs and minutes duration.

 

I tried using after business rule too. and the start condition is Business Elapsed Time changes. But it is not changing the value when  Business Elapsed Time changes. Business Elapsed Time value changes continuously until it may got completed/canceled. but it is taking only one value and then it is not changing.

@Jaspal Singh 

 

I have created database view and combined RITM table and Task SLA. But we want to change the label for business elapsed time in database view only but unable to do it. Tried to change the label in database view but not working. Please check the attached screenshots

Rakesh50_0-1699370769366.pngRakesh50_1-1699370887377.png

 

Hi @Rakesh50 , thread has solution. Check for comments from Maik.