+ Start a Discussion
Mani Cube84Mani Cube84 

how to use businesshours in triggers, need to exclude the holidays while counting the business hours

how to use business hours in triggers, need to excluide the holidays while counting the business hours, need to get previous working date which excludes the custom holidays if any and count 2 days other than holidays and week days

Order Due Date : Sunday, March 10, 2013

I need to get its previous working date which would be Friday, March 08,2013. 

Also I want to make sure that if Friday was an holiday then it should return me Thursday, March 07,2013. 

I have already looked at the business hours class  (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_businesshours.htm)
I was able to get the next buisiness day but not the previous buiseness day.
This is very urgent, I will appreciate if some one can provide me sample code for this.
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Mani,

Using a formula to exclude weekend and holidays in Salesforce May I suggest you to please refer the below link for reference. Hope it will be helpful.

Please mark it as best answer if the information is informative.

Best Regards
Rahul Kumar