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-14-2019 04:07 AM
How do you want to see the value on the duration field, and what are you getting at the moment??

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2019 07:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2019 07:49 AM
Can you confirm the type of Actual Effort hours field, i don't think it is duration type.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2019 09:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2019 02:20 AM
Hi Andrew,
I think i got it,
This is how i see this field in my personal instance
Then I went in the dictionary and checked the read only flag to true
Now I see the field on the form as
Please mark my answer correct/helpful if it helps you solve your issue.
-Anurag