Archive for April, 2007

API version 8 and fast vs. slow

Wednesday, April 25th, 2007

I’ve been talking about Apex a lot lately, but I want to go back and sing the praises of the 8.0 API which was released in January. I know that’s old news, but it has made our daily work much more palatable.

I built an S-Control that is a weekly timesheet. It allows us to track our time against projects. The interface shows a lot of data–each time entry has basic info (hours, date, comments) and also is related to an Opprotunity, and Account, and one other custom object. In a typical week, each person would have 20-40 time entries.

timecard.png

With the 7.0 API, I would load all the time entries for the current week–one Query. Then, for each time entry, I had to Retrieve data from the Opportunity, Account, and custom object, so the names of each would be displayed. That’s 3 more calls. So a by the end of a typical week, loading the timesheet for a person would take 100+ calls to the API. It was slow.

With the 8.0 API, I do things a little differently. I make an initial Query call to get the time entries. Using a feature called Relationship Queries, that initial call also pulls in the related information from the Opportunity, Account, and custom object. So at the end of a typical week it takes 1 call to load the timesheet.

Because of the 8.0 API I got rid of 99% of my API hits. I think this is a fairly common use case, so I can imagine lots of application developers are feeling this kind of improvement. Not surprisingly, my users have noticed the performance improvements, and in their eyes the timesheet app has gone from a bit painful to painless.

Salesforce.com Developer conference May 21st in Santa Clara

Tuesday, April 24th, 2007

I’ll be attending the one-day Salesforce.com Developer Conference in Santa Clara on May 21st.

If you’re in the bay area, or want to travel to this free event, it would be great to see you there!

Clicktools: getting outside feedback into Salesforce

Tuesday, April 24th, 2007

Clicktools is a killer data gathering tool that integrates with Salesforce.com. It’s a great product, and the company is donating it to nonprofits. We’ve just started using it and we’re blown away by how powerful it is.

Check out this short screencast of how we’re using it.

Thanks again to Clicktools for donating their amazing product for our use!

Daily cron jobs with Apex

Tuesday, April 17th, 2007

To date, there has been no way to run code that manipulates Salesforce.com on a predetermined schedule, without having an external server and some sort of scheduler. Lots of people are running these kinds of scripts, but the folks I work with don’t have those kinds of resources. One of the things I love about on-demand is that I don’t have to keep servers running, so I shied away from writing these kinds of scripts.

In playing with Apex, I came up with a way to run Apex scripts every day, with no user intervention. It relies on two things: time-based workflow and Apex triggers. Here’s a run down of how it works.

I created a custom object called Batch Script and then created on instance of that object.

batch_script.png

It’s got two fields that matter: a last run date field and a run checkbox. The next step is to create a timebased workflow on the object.

cron_field_update1.png

The workflow kicks off when the last run date is one day ago. When this state is reached, the run checkbox is updated.

Now, and Apex trigger fires on the update of the Batch Script object. Here’s the code:

trigger TestScript on Batch_Script__c bulk (after update) {
//if checkbox is checked, run the script
  for (Batch_Script__c bs : Trigger.new) {
    if (bs.Test_Script_Run__c == true) {
      //run whatever APEX code you want
      Batch_Script__c ourBS = new Batch_Script__c (
        Id = bs.Id,
        Test_Script_Run__c=false,
        Test_Script_Last_Run_Date__c=system.today()
      );
      update ourBS;

    }
  }
}

This trigger runs arbitrary Apex code if the run checkbox is checked. After running the code, the run checkbox is unchecked and the last run date is set to today. Tomorrow, this will happen all over again–the code will be run and the object will be returned to a state where it will fire again in 24 hours.

Do you have more control with a cron job running on an external server? Sure. Is this a kludge? Absolutely. But if all you want to do is run daily jobs that use Apex to work with your data, you can use this method and save the headache of outside servers.

These new pieces of functionality are making things possible that weren’t possible before. That’s a great sign for the future of the platform–as long as they make more things possible, the platform will continue to get more powerful.

Just a normal weekend

Sunday, April 15th, 2007

DSC_0032.JPG

Kurt Vonnegut, RIP

Thursday, April 12th, 2007

A great American author passed away last night–Kurt Vonnegut died at the age of 84. If you haven’t read any of his work, you’ve missed out on some of the most creative, funny, and touching stories of the last century. Cat’s Cradle blows me away every time I think about it. He was a true genius.

In 1995 when I was looking to purchase a domain name I settled on gokubi.com after reading Vonnegut’s Galapagos, where gokubi was his name for a gadget from the future. It was an instant translator, allowing people of different languages to communicate. For no real reason other than his creativity grabbed me, I grabbed the domain name.

Take this opportunity to read some Vonnegut: Cat’s Cradle, Slaughterhouse Five, and Breakfast of Champions are all wonderful.

The most fitting Vonnegut quote for today is clearly this,

And if I should ever die, God forbid, I hope you will say, “Kurt is up in heaven now.” That’s my favorite joke.

Feed for New Items on the Appexchange

Tuesday, April 10th, 2007

The folks at Appexchange redesigned a while back and killed the RSS feed for newly published items. I created a feed for newly published items that appears to work–at least until they redesign again. I made it with page2rss.com.

Update: They’ve posted an official feed of new apps.

NTC and the concept of faceted celebrity

Tuesday, April 10th, 2007

NTC was fun. I got to see lots of great people I don’t get to see enough: Sonny Cloward, Amanda Hickman, Micheal Silberman, Leda Deiderich, Steve Wright to name only a few.

I also got re-exposed to something I called “faceted celebrity.” The basic concept is this, the intersection of the subdomains in which you are proficient is a facet. For me, I am proficient in Salesforce.com, nonprofit processes, and software development. There are thousands of people who are proficient in any one of these facets, but the intersection of these three domains is a pretty small one. In that intersection, I enjoy my 15 minutes of faceted celebrity, and NTC happens to be where the people interested in that facet (all 5 of them) gather together.

Faceted celebrity is not a new concept, there have always been domain experts where the domain is so small most people don’t even notice it. But Internet publishing has greatly increased to opportunities for these small communities to stay in touch.

Jon Stahl, my awesome coworker, enjoys a decent amount of faceted celebrity in the NTEN community as well. Which is why, at dinner one night, I overheard this from a respected technologist,

“I first decided Jon Stahl was a legend in this community when…”

Needless to say Jon asked that this be repeated multiple times over the course of the night…

Apex trigger screencast

Friday, April 6th, 2007

Apex triggers rock the house. I’ve been showing this stuff to lots of Salesforce.com implementers at the NTC conference the last few days and the reaction has always been the same: dropped jaws, and the question, “when is this going to production?”

Check out this screencast of how triggers can make Salesforce.com tons easier to use in the real-world example of Households. Tell me what you think!

Salesforce.com for Political Campaigns

Friday, April 6th, 2007

Nonprofits get Salesforce.com donated, but anyone can buy it. Turns out Mitt Romney decided to buy Salesforce to manage his fundraising.

If you look at Mitt’s login page, you’ll notice in the URL that it’s hosted by Theikos, a consulting company out of Boston that does Salesforce.com development for corporate clients and nonprofits. I don’t know the details of how much work was done by sf.com employees to build for this new vertical and how much was done by Theikos. Definitely interesting, even if it is for Mitt Romney.

Update: CampaignForce in the comments points us all to the Appexchange listing for what Mitt is using.