Convert days entered into hours

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2019 02:52 AM
Hello,
I have a business rule the converts a duration field (Hours, Minutes and Seconds) into a number of working days represented (based on a 7.5 hour working day):
(function executeRule(current, previous /*null when async*/) {
var time = (current.effort.dateNumericValue());
current.u_planned_effort_days.setDisplayValue(time/(60*60*7.5*1000));
// Add your code here
})(current, previous);
It works fine but the operators want to option to add planned effort to a project either by entering the number of hours (and having it converted and displayed) OR entering the number of days and having it converted to hours.
We need to keep the concept of hours because our workforce uses hours to record their time on time cards.
It seemed simple to reverse this BR so that it looks like this:
(function executeRule(current, previous /*null when async*/) {
var time = (current.u_planned_effort_days);
current.effort.setDisplayValue(time*(7.5));
// Add your code here
})(current, previous);
I tried it with .dateNumericValue in place first. Didn't work and so I removed it based n the idea that the value is already numeric. This calculation should simply take whatever number is added to u_planned_effort_days and the set the value of current.effort to whatever it is multipled by 7.5.
It doesn't work.
Any ideas?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2019 03:09 AM
Thank you. I'll give that a try and give you props if it works. 😉