How to set Business Duration field on RITM?

damodharan1
Tera Contributor

I'm not able to set business duration field on old ritms and i have used below codes.
var grRITM = new GlideRecord('sc_req_item');
grRITM.addEncodedQuery("number=RITM18884753^business_duration=javascript:gs.getDurationDate('0 0:0:0')");
grRITM.query();

if (grRITM.next()) {
var opened = grRITM.opened_at.getValue();
var closed = grRITM.closed_at.getValue();

if (grRITM.business_duration == '') {
grRITM.business_duration = gs.calDateDiff(opened, closed, false);
grRITM.update();
}
}


Is there any alternative method for calDateDiff.

16 REPLIES 16

@damodharan1 

what was the case raised for?

the BR on incident is OOB and it works, so it should work the same for RITM table

what did ServiceNow say about that case?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Shivalika
Mega Sage

Hello @damodharan1 

 

Please confirm if you checked my answer. Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for my efforts and also it can move from unsolved bucket to solved bucket. 

 

Regards, 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeE