Calculate business duration based on start date & end date field.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 02:24 AM
calculate business duration based on start & end date fields.Start date value will set once state changes to work in progress *& end date will set once state move to close complete.This scenario which Business rule will use.
i have used after business rule. But can't use current.update() right.so i have writter aync also its not setting the business duration.
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
gs.info("check br duration");
var start = new GlideDateTime(current.work_start.getDisplayValue());
var end = new GlideDateTime(current.work_end.getDisplayValue());
var duration = GlideDateTime.subtract(start, end);
current.business_duration = duration;
//current.update();
gs.info("business_duration"+current.business_duration);
})(current, previous);
0 REPLIES 0