function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AneeshaAneesha 

Calculate future date based on current date + duration

Hi,

 

I have looked all over the place to find a way to do it. But with no luck!

 

My requirement is to send an email to the case owner when the case SLA is reaching in 2 days. I have the SLA count which is a number and the case created date. I know I can find the date of SLA by simply adding CreatedDate + SLA, but I also need to exclude the weekends and holidays if possible. I atleast need to remove the weekends.

 

So suppose a case was created on Wednesday and the SLA is 5 days, then the user should get a mail on Monday, rather than on Saturday. I am planning to implement this through a WF rule with time base trigger but I need the correct date field to send the mail. Please help

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
sflearnersflearner

Aneesha,

 

use formula

MOD( YourDate - DATE(1900, 1, 7), 7)=6(saturday) -->increment the date to +2

MOD( YourDate - DATE(1900, 1, 7), 7)=0(sunday) --> increment date to +1

 

For holidays I think you can use triggers.

Create a custom object HOLIDAY which has all the holidays for a particular year e.g.

Independence Day 2013 -  07/04/2013

...

When inserting or updating calculate the date by quering this object with your date if it retrieves a row increment to +1

 

 

All Answers

AroraAnupAroraAnup

Are you using the native Salesforce.com Entitlements feature? It does the exact same function i.e. sends out notifications to the Customer/Internal Stakeholders depending upon certain criterias:

 

1. Customer Type (Gold, Silver, Platinum)

2. Case Type

3. Case Priority/Severity - Critical, High, Medium, Low

4. Type to Entitlement and Service Contract

 

Using this, you can trigger time based notifications, also keeping in view the Business hours and Working days (i.e. you can exclude weekends). You can even start/stop the SLA timer clock if the case is pending on the customer for additional details.

 

Let me know if you are using this feature

AneeshaAneesha

Hi CloudKnight,

I am not using this feature.

As far as I know Entitlement management requires an entitlement to be present in SFDC for the user who is creating the case. But in my case, we sre simply using cases to track the tickets raised for a particular functionality, that is outside of salesforce. So the user may/maynot have an account,contact, entitlement etc in SFDC.

sflearnersflearner

Aneesha,

 

use formula

MOD( YourDate - DATE(1900, 1, 7), 7)=6(saturday) -->increment the date to +2

MOD( YourDate - DATE(1900, 1, 7), 7)=0(sunday) --> increment date to +1

 

For holidays I think you can use triggers.

Create a custom object HOLIDAY which has all the holidays for a particular year e.g.

Independence Day 2013 -  07/04/2013

...

When inserting or updating calculate the date by quering this object with your date if it retrieves a row increment to +1

 

 

This was selected as the best answer
AneeshaAneesha
Thanks sflearner. I have done something similar for my requirement. I used the standard Holiday object to track holidays though,