Authored by Zishan Razzaq
Showing posts with label Date. Show all posts
Showing posts with label Date. Show all posts

Sunday, July 8, 2012

SLA - Service Level Agreement Case Times

Hi:
   Scenario:
     Business wants to know the following:
  1. How many hours a case has been open?
  2. How many days a case been open?
All for SLA - Service Level Agreement amongst the business units who you support.

Solution:
We can utilize many methods, I will list out number of hours a case been open and number of days a case been open.

"DATEVALUE" <== a formula method that "Creates a date from its datetime or text representation"

To get the number of hours a case been open, we will not utilize "DateValue" but just common mathematical formula.
Let's say the 2 fields we are utilizing are CreatedDate and LastModifiedDate

Knowing there are 24 hours in a day worldwide... lets use that:

(24* (LastModifiedDate - CreatedDate  ))

 This formula will give you the number of hours between the 2 fields.

The Number of Days a Case been open:

Let's say you are utilizing a formula field which based on the type of case that comes in counts off the number of days SLA should meet for that case.

Lets say for "User Profile Change" type of case that comes in, the number of days to get back to the user is 1 day.

Field: SLA Expectations | SLA_Expectations__c | Attribute - Number (2,0) | Formula

Formula is:
IF(Type='User Profile Change',1,0)

Now we will use that field to figure out if the SLA was met or was it over 1 day.

Create another formula field named: SLA | SLA__c | Attribute - Number (2,0)

Formula is:
(DATEVALUE (CreatedDate) + SLA_Expectations__c) - TODAY()

This shall give you the result you need to figure out SLA which you can then set up an escalation rule to send out an email to the manager of operations let say that SLA was not met.

Great for reporting purposes as well :)

Thank you everyone
Hope this helped
Zishan

Wednesday, January 20, 2010

Determine End of Month Date or Days in Salesforce.com

Scenario:
   A) Determine how many days in a month.
   B) Determine how the End of Month Date

Solution:
For A:
   DAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1)-1) <== This will determine the days in the current Month.
For example: For Jan there are 31 Days in the month.

For B:
DATE(YEAR(TODAY()) ,MONTH(TODAY()),DAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1)-1))

This will return the actual end of month date...
For January it will return January 31, 2010.
This does not accomodate Leap Year:
So an easier way to do this would be:
DATE(
YEAR(TODAY()),
MONTH(TODAY()),
CASE( MONTH(TODAY()),
1, 31,
2, IF( MOD( YEAR(TODAY()), 4) = 0, 29, 28),
3, 31,
4, 30,
5, 31,
6, 30,
7, 31,
8, 31,
9, 30,
10, 31,
11, 30,
12, 31,
0
)
)

This will return for the Month of Feb: Feb, 28, 2010.

Now to get Last Day of Next Month it would be similiar:
DATE(
YEAR(TODAY()),
MONTH(TODAY())+1,
CASE( MONTH(TODAY())+1,
1, 31,
2, IF( MOD( YEAR(TODAY()), 4) = 0, 29, 28),
3, 31,
4, 30,
5, 31,
6, 30,
7, 31,
8, 31,
9, 30,
10, 31,
11, 30,
12, 31,
0
)
)

This will Return The Next Month Like March:
March 31, 2010.
Now if you are using a Date field to determine the end of that current month and using a formula field to do so...
Substitute the TODAY() with the field that you want the formula to go off from...

Thank you
Check out my Other Blogs:

VisualForce Made Easy
Data Migration Made Easy
eTechCareers.com  Coming Soon!!!! All of your Employment needs for Information Technology and Project Management.
LINKS: