How to remove weekend days from formula to count days between two date?

We have a field on our custom approvals records module that counts the days between the start of the process to the approved date with the following formula. 

ifElse(greaterThan(strlen(toString($date_approved_c)),0),add(subtract(daysUntil($date_approved_c),daysUntil($process_start_date_c)),1),"")

how can we exclude weekends?

We have SLAs we want to put out and enforce with approval teams but knowing the data is skewed to include weekends, it doesn't seem fair to do so until we have a solve for removing weekend. Most approvals will happen within less than a day so also looking to see how to turn this into hours, then I'll need business hours. We do not have business centers in place yet either. 

Parents
  • In the cases module you can find very powerful functions to calculate the resolution time of a case absolutely and respecting the business times of a business center for SLAs. You find these in the issue template include\SugarObjects\templates\issue\Issue.php.

    Check function calculateResolutionHours().

    Perhaps you can use or copy something from there in a logic_hook

Reply
  • In the cases module you can find very powerful functions to calculate the resolution time of a case absolutely and respecting the business times of a business center for SLAs. You find these in the issue template include\SugarObjects\templates\issue\Issue.php.

    Check function calculateResolutionHours().

    Perhaps you can use or copy something from there in a logic_hook

Children
No Data