Wednesday, April 09, 2008

salesforce.com cron

Time-based workflows in salesforce currently execute relative to a time. For example, you can use them to to schedule a task for the case owner to follow up with the customer two days after a
case is closed.

It's not currently possible to schedule time-based workflows to execute at a particular time every day - like a cron job would. For that, we'd need to add some secret sauce to time-based workflows.

The Apex trigger below will populate a custom DateTime field called Midnight_Local_Time__c with, you guessed it, midnight - local time for the running user. In conjunction with a time-based workflow, this trigger would allow you to do things like lock all 'Closed' Case records at midnight
trigger Case_PopulateMidnightLocalTime on Case (after update)
{
List cases = new List();
for(Case c : [SELECT CreatedDate FROM Case WHERE Id IN :Trigger.new AND IsClosed = true AND Midnight_Local_Time__c = null])
{
CaseTriggerHelper.SetMidnightTime(c, c.CreatedDate);

cases.add(c);
}

update cases;
}

public static void SetMidnightTime(Case c, DateTime dt)
{
// SFDC defaults 'Midnight' to the 'Time' for this call to newInstance();
DateTime midnightLocalTime = DateTime.newInstance(dt.year(), dt.month(), dt.day());
midnightLocalTime = midnightLocalTime.addDays(1).addMinutes(-1);
c.Midnight_Local_Time__c = midnightLocalTime;
}
If you use this, you'll want to keep in mind that there are limitations around time-based workflows and triggers though:
  • Time-based workflows aren't guaranteed to execute exactly on time, there could be a significant delay in their execution.

  • Unlimited Edition is limited to 20,000 time triggers per org

  • Enterprise Edition is limited to 10,000 time triggers per org
Linvio's CronKit appears to be a useful solution to this problem as well.

Wednesday, April 02, 2008

"No" - In So Many Words

Update January 26, 2014: Jared Spool conveys my thoughts much more clearly in his Beans and Noses post.

Update April 24, 2008: I've been revising this post regularly over the past month. I think that it expresses how I feel about saying "No" to a client, but I reserve the right to modify this post, and my opinion, in the future. Also, I do think that it can be appropriate to tell our clients "No" on occasion, but those scenarios are a topic for another day.

As an IT software engineer, and even as a newbie technology consultant, I didn't realize that my relationships with my clients required a relatively high degree of finesse. I had become accustomed to having very candid conversations with other technical people about what was technologically feasible for a given project. We regularly used the word "No" in these conversations. And we regularly used the word "No" when talking with the business about their requests. Looking back though leads me to believe that telling the business "No" probably hurt my teams' reputation - saying "No" to each other was probably counter-productive in some cases as well.

I've worked with clients whose project goals were to improve customer satisfaction, or to reduce operating expenses, or even to introduce new product lines. At the core, all of these project goals boil down to a desire to improve the business. Our job as technology experts is to provide the business with the tools that they need to accomplish their goals. And just in the way that a carpenter wouldn't like using a hammer that refused to pound nails, our business clients don't like technology experts that refuse to help improve the business by saying "No".

I have learned that it can be much more effective to be indirect and to guide the client to the conclusion that they don't really want to implement their request. Some of my favorite ways of doing this are:
  • "How important is this request compared to the others that we've identified?"
  • "Can you tell me more about why you want to do X?"
  • "That's a great idea, we can do that - have you considered how it will impact Y?"
  • "We can do that, but it will probably increase our timeline/cost." (optional: "Are you willing to accept that?")
  • "That makes a lot of sense, we can definitely do that, but we will probably have to cut out another feature." (optional: Which feature can we remove?")
Customers can request crazy, even impossible, things sometimes, but I've found that my relationships are much more productive if I can think of creative ways to get the customer to consider their request in a different light. The customer may not always be right, but that doesn't mean that we have to tell them that they're wrong.

Thursday, March 06, 2008

Speaking of Platforms...

My last post made me realize that I haven't already pointed out Marc Andreessen's excellent essay: The three kinds of platforms you meet on the internet.

And if the essay itself wasn't reward enough, check this out:

Get Your salesforce.com Org Under Version Control

Jeff Atwood, a software engineering hero to many, recently wrote about version control for databases.

His post spurred me to use the Force.com IDE to put my latest salesforce.com project under version control. It's dead simple to utilize a version control system for your entire salesforce application now: S-Controls, Apex code and salesforce schema included. (Here are the instructions for Subversion: Force.com Code Share)

If being able to define a database, build complex logic and create a sophisticated user interface wasn't enough to convince everyone that salesforce.com is a true development platform, the Force.com development environment just made it a little bit harder to deny.

And the whole platform is delivered as a service...

Saturday, February 23, 2008

V-shaped (Junction Object) Reports

Custom Report Types are incredibly powerful, but one feature that you might not know about, is the ability to "go back up" the object hierarchy.

Let's imagine that your business has a call center and that every once in a while one of your products breaks. When this happens, the affected customer will call your 1-800 number and ask for a replacement product. As a company, you're happy to oblige, but you want to run a report on Cases, Replacement Orders and Products to try and detect breakage patterns. With traditional salesforce reports, you'd be stuck, because the object relationship is V-shaped:



Using standard salesforce reports, you could easily run a report on Cases and Replacement Orders, but you wouldn't be able to "go back up" to get any Product fields beyond the name of the Product being replaced.

Allow me to introduce you to the little-known hero of our story, the "Add fields related via lookup" hyperlink for Custom Reports:




The "Add fields related via lookup" hyperlink will allow you to add fields from the Product table to your report on Cases and Replacement Orders.

And now you'll be able to save the company untold millions by detecting product breakage patterns - all thanks to one little hyperlink.

If you want to build a similar report in your salesforce org, you'll need to define a custom report type with one or more related objects:

Once you've defined your custom report, the next two steps are just a matter of clicking on the "Edit Layout" button and the "Add fields related via lookup" link. Happy Reporting!

Saturday, February 09, 2008

Favorite HTML/JavaScript Resources

Microsoft's HTML and DHTML Reference. It's saved me hundreds of times - and it's a lot more up to date than my 1998 version of HTML: The Definitive Guide.

DevGuru: JavaScript. Simple and straightforward JavaScript reference.

W3Schools JavaScript Tutorial. Easy to understand examples - that you can experiment with!

Friday, January 25, 2008

Spring '08

My favorite new feature is not Dashboard Scheduling or Apex Code in EE or even Outer-Join Reporting - it's the improved user interface for building list views. I'm creating list views like never before!

Monday, December 10, 2007

Network Effects

I think that Charles Zedlewski gets it exactly right in his post A new wrinkle on SaaS when he says this about "Salesforce to Salesforce":

This is something that would be difficult for on-premise vendors to replicate: an application network effect that's could be genuinely beneficial to the user.

This will be a powerful feature as companies with an indirect business model begin to leverage it with their partners.

Just think how hard it would be to implement this functionality with an on-premise solution - the logistics of coordinating IT organizations would be monumental.

Thursday, November 29, 2007

Coincidence or Lax Beta Tester Screening?



+

Called "My Location", the feature comes as part of the release of version 2.0 of Google Maps for mobile. My Location uses cell tower ID information to determine approximately where you are.

Too soon?

Friday, October 12, 2007

Sales Forecasting Simulator

The Stanford Graduate School of Business has a class called "Building and Managing Professional Sales Organizations" that allows students to gain experience forecasting sales using a simulator. The simulator allows students to experience the difficulty of forecasting from the perspective of a sales rep and from the perspective of a sales manager.

http://www.gsb.stanford.edu/news/bmag/sbsm0711/feature-simulator.html

I wonder when they're going to release their simulator for the PS3...