You need to sign in to do that
Don't have an account?

Use apex/formula to determine a weekend and a holiday
I want to determine the next business day if a service request is submitted on a weekend.
example: If I submit a service request on a weekend (Saturday/Sunday). The actual date received should be a Monday (which is the business day not Sunday or Saturday). Now if Monday is a holiday, I want the next business day to be the actual date.
I will store this in a different field. I will still keep track of the actual date the service was requested ( Received Date) and populate Business Day with the right date using the formula.
I don't want to use Apex if possible i want to use formulas. We already know the list of Holidays for a calendar year and it is same every other year. The only issue is when a national holiday falls on a weekend (USA) obviously the Monday becomes a holiday. I wonder how it can be handled.
If you have apex solutions too i am willing to hear you out
example: If I submit a service request on a weekend (Saturday/Sunday). The actual date received should be a Monday (which is the business day not Sunday or Saturday). Now if Monday is a holiday, I want the next business day to be the actual date.
I will store this in a different field. I will still keep track of the actual date the service was requested ( Received Date) and populate Business Day with the right date using the formula.
I don't want to use Apex if possible i want to use formulas. We already know the list of Holidays for a calendar year and it is same every other year. The only issue is when a national holiday falls on a weekend (USA) obviously the Monday becomes a holiday. I wonder how it can be handled.
If you have apex solutions too i am willing to hear you out
The scenario is quite intresting. I want to ask you, how are you planning to store the holiday dates in a field? Are you creating a picklist or text field for it?
Thanks
2. If it is on Apex, then I will query from salesforce.
After, I just have to assigne the right date to a field called business date for reporting purposes per record.
You can use formula field and solve for one day holiday like if request is made for sunday while if monday is holiday , you can shift it to tuesday ..That might be feasible. Lets say a scenerio like someone made service request on satrday , while monday and tuesday are holiday and so the actual request date must be made as wednesday , this means some kindof recursive approach is necessary in formula field. Sadly , i doubt this is feasible for now.
Thanks,
Shiva RV
In apex it's perfectly possible. Have a custom setting containing the list of holiday's other than saturday, sunday.
You can use the below code snippet. doesItExists sample Implementation :
Let me know if you need any help on this.
Thanks,
Shiva RV
yes you could do that..that holiday in apex aspect didnt strike me.. that must also work in the same way..only thing is, not sure how they handle satrday and sunday.. i dont think entry for every satrday and sunday will be there..
but yeah its a good solution then custom setting😄
Thanks,
Shiva RV
As of now we can't use the Holiday Object in the formula field or workflows. Either store the holiday dates in a seperate field and use that field in the formula to check if its a holiday or not. I think you should use apex for this it will be much easier.
https://success.salesforce.com/ideaview?id=08730000000BpWdAAK
Thanks
you are right, but i dont think we can do it in formula field... in apex , holiday object can be used ..
thanks,
Shiva RV