MK Partners Archive for October, 2007

No More Weekend Tasks

If you’re like us, you probably have a lot of Workflow Rules and Tasks setup in Salesforce. It’s a great feature that helps to automate processes and it ensures accurate and timely notification across your organization.

One thing that has always bothered me about Salesforce’s Workflow is that it doesn’t take weekends into consideration (unlike Case Escalation Rules). Well if you have access to Apex Code, here is a simple Task Trigger that will update Tasks created with a due date on Saturday or Sunday to instead have a due date on Monday or Tuesday.

Just create a new Task Trigger with the following code:

trigger WeekendTasks on Task (before insert) {
	for (Task tas : Trigger.new) {
			Date origin = Date.newInstance(1900,1,6);
			Date due = tas.ActivityDate;
			Boolean reminder = tas.IsReminderSet;
			Integer x = origin.daysBetween(due);
			Integer day = Math.mod(x,7);
			if (day < 2 ) {
				tas.ActivityDate = (due + 2);
				if (reminder == true ) {
					Datetime rem = tas.ReminderDateTime;
					tas.ReminderDateTime = (rem + 2);
				}
			}
	}
}

Special thanks to Eric Bezar at The Official Salesforce Blog for help with the original formula.

Tracking the duration of a call

If you haven’t joined the CTI bandwagon, then you probably have a hard time tracking the duration of your calls (tasks) in Salesforce. At MK partners, we’re already enjoying the benefits of the Skype CTI Connector, but for one of our clients it wasn’t an option. So, we developed a simple process to help them capture the amount of time their reps spend on logging calls in Salesforce. It’s so simple in fact that we’re giving it away, just follow these two steps:

  1. Create a new Activity custom field as follows:
    Datatype: Date/Time
    Field Label: Call Start
    Default Value: NOW()
    Field Level Security: Make it Visible to all profiles
    Page Layouts: Don’t display it on any of your page layouts
  2. Create a 2nd Activity custom field as follows:
    Datatype: Formula
    Field Label: Call Duration
    Formula Return Type: Text
    Formula:
    TEXT(CEILING(0.24*FLOOR(100*(CreatedDate -Call_Start__c))))
    & “:” &
    RIGHT(“0″&TEXT(ROUND(MOD((1440*(CreatedDate-Call_Start__c)),60)+0.5,0)-1),2)
    Profiles/Field Level Security: Make it Visible to all profiles
    Page Layouts: Display it on your Task page layouts

That’s it! You now have a field that will track the amount of time between when you click “Log A Call” and “Save”. Now you just have to create the reports and dashboards to analyze and improve your call efficiency. Good Luck!