- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 01:45 AM
How to convert glide duration filed into seconds and, this seconds to be add into glide date time filed
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 01:47 AM
I achieved with the below code
/**
-> dues date will be the time it got assigned and delivery_time
-> created custom after insert business rule as per the busimess need
-> Auto populating delivery time of catalog item in the generated RITMs due_date & expected delivery
-> ritmRec.cat_item.delivery_time is catalog item delivery time duration type filed populated in REQ & RITMs due date
**/
var ritmRec = new GlideRecord("sc_req_item");
ritmRec.addQuery("request", current.getUniqueValue());
ritmRec.query();
while (ritmRec.next()) {
if (JSUtil.notNil(ritmRec.cat_item.delivery_time)) {
var deliveryTimeGlideDate = new GlideDateTime(ritmRec.cat_item.delivery_time);
var seconds = deliveryTimeGlideDate.getNumericValue() / 1000;
var openedGlideDate = new GlideDateTime(current.opened_at);
openedGlideDate.addSeconds(seconds);
ritmRec.due_date.setValue(openedGlideDate);
ritmRec.estimated_delivery.setValue(openedGlideDate);
ritmRec.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 01:47 AM
I achieved with the below code
/**
-> dues date will be the time it got assigned and delivery_time
-> created custom after insert business rule as per the busimess need
-> Auto populating delivery time of catalog item in the generated RITMs due_date & expected delivery
-> ritmRec.cat_item.delivery_time is catalog item delivery time duration type filed populated in REQ & RITMs due date
**/
var ritmRec = new GlideRecord("sc_req_item");
ritmRec.addQuery("request", current.getUniqueValue());
ritmRec.query();
while (ritmRec.next()) {
if (JSUtil.notNil(ritmRec.cat_item.delivery_time)) {
var deliveryTimeGlideDate = new GlideDateTime(ritmRec.cat_item.delivery_time);
var seconds = deliveryTimeGlideDate.getNumericValue() / 1000;
var openedGlideDate = new GlideDateTime(current.opened_at);
openedGlideDate.addSeconds(seconds);
ritmRec.due_date.setValue(openedGlideDate);
ritmRec.estimated_delivery.setValue(openedGlideDate);
ritmRec.update();
}
}