"With Visualforce I can write apps that are running fast and instant, with complete control over the user interface."


—CRM Fusion

Coding With Apex: Salesforce Toolmaker's Batch Product Goes Real-time

Apex code is still in preview, but Glenn Wilson of Toronto's CRMfusion has already put it to work—c reating a prototype application that's well on its way to becoming a product. Called DupeBlocker, the real-time deduplication tool will be ready to ship as soon as Apex code is released.

Apex code, the world's first on demand, multi-tenant programming language, is still in the preview stages. But some Apex developers have already begun coding. Among the first is Glenn Wilson, founder of CRMfusion Inc., who enrolled in the developer.force.com within nanoseconds of hearing about it. Working part time over the next few weeks between other projects, Wilson created the prototype of a product called DupeBlocker, which identifies duplicate salesforce.com records as they are being entered and every time they are edited. In doing so, Wilson has also demonstrated the power and potential of Apex code, itself.

Wilson first heard about Apex code at Dreamforce 2006. "I quickly realized the technology provided something fundamental to our development process. Most of the AppExchange apps use a data model inside of salesforce.com, using s-controls in conjunction with JavaScript to execute in the browser. But because our apps needed more processing power, we instead use the Apex API, building client-based applications that connect to salesforce.com through SOAP." Of particular concern was the processing power needed for CRMfusion's deduplication tools, which must be able to quickly locate and merge thousands of duplicates.

But Wilson was never quite satisfied offering just client-based solutions, because they run counter to salesforce.com's on-demand approach. To achieve tighter integration, CRMfusion even considered hosting its own servers—but the cost was prohibitive.

 

With Apex code, we can finally run our own code within salesforce.com's multi-tenant environment. As a result, we've been able to create DupeBlocker, our first real-time deduplication checker. It inspects the data as it is entered and either allows it, prohibits it, or flags it with a warning and provides different options to merge records.

 

CRMfusion will offer DupeBlocker to customers already anchored by the company's flagship product—DemandTools for AppExchange, a suite of 15 client-based application modules for manipulating Salesforce and AppExchange data. CRMfusion built the suite on the Microsoft .NET Framework, introducing the product at Dreamforce 2004.

"DemandTools does some pretty wonderful things," says Wilson, "including deduplication, matching IDs, and mass updating. More than 1000 companies, including salesforce.com itself, now use the tool; by now it has updated billions of Salesforce records. DemandTools sales have risen from US$300,000 in 2005, to more than $1.2 million in 2006, with at least $2 million expected this year."

From batch to real-time

DemandTools' deduplication features are currently offered as post-processing "cleansing" tools. The Single Table Deduplicator, for example, runs through a salesforce.com database to compare leads versus leads, contacts versus contacts, or any other object against itself. Other tools can find duplicates that exist between leads and contacts or between leads and accounts. In all cases, the duplicates are eliminated via record merging en masse.

 

With Apex code, Wilson saw the possibility of catching duplicates in real-time, before they enter the database. "Batch processing made us something of a black sheep within the salesforce.com world," says Mark Esdale, CRMfusion's vice president of business development. "With Apex code, we've arrived at what the data quality world calls a fourth-generation solution—with all the filtering, normalization and other data-related QA tasks done every time a user touches a record. The days of people going on long missions of cleansing databases are coming to an end."

 

CRMfusion announced the Apex-developed DupeBlocker on its blog, which is linked to a four-minute online demo.

As soon as Apex code is available we plan to be shipping," Wilson says. "Once our customers install DupeBlocker, they'll probably never create another duplicate again.

 

Apex code: From idea to prototype in 120 hours flat

Developing the DupeBlocker prototype took Wilson about 120 man-hours. Working solo out of his Toronto office, he finished just a month after the Apex code announcement, while still running his $2 million company. "Learning the code was easy, because it's really nothing more than Java combined with SOQL. That is, if you can write Java code and SOQL queries to update salesforce.com objects, you can create Apex code. So by leveraging our existing business logic from our commercial products, we were quickly in business and were able to show a working prototype."

That business logic is at the heart of the DupeBlocker. "Building a deduplicate tool is tricky because my duplicates are not yours: every company has a different definition of the term," Wilson says. "Just what constitutes a duplicate record? Is it when every field is identical? What if the company names vary, but the address is identical? What about the reverse. Our approach is a mix of fuzzy logic and the ability of the user to customizea definition."

 

But with the business logic already in place, development itself was straightforward. "After enabling an Apex developer account, I downloaded the Eclipse plug-in so I could have a development environment to work in. Then I converted our code from C#—it was very straightforward. There were a few nuances to learn, of course. Apex contains built-in governors that prevent a chunk of code from spinning into an infinite loop. So I needed to learn how to code around them. And because Apex code is interpretive, I needed to learn how many script statements I could do before having to update a particular object. But the actual porting of the code from .NET to Apex was just a matter of reworking it into a Java-like syntax. As for the SOQL queries, I didn't have to change a thing."

 

DupeBlocker development is now running in parallel with final specification of Apex code. "There are still some holes to be filled in; we're still waiting for regular expressions, for example. But when Apex code is ready, we'll be too."

 

"The best business decision I ever made"

Wilson's programming career had an unlikely start. With a degree in mining engineering, he worked in that industry before a nine-year stint as a sales engineer at the pioneering PC computer-aided design company, Autodesk. A programmer hobbyist, he turned pro in 2001 when he launched CRMfusion. Wilson's experience is primarily in C and .NET, with exposure to Java through working with JavaScript.

Wilson's first encounter with salesforce.com came after developing tools for a struggling, online CRM system later purchased by Siebel (which in turn, was purchased by Oracle). "When that happened, I figured it was time to bet on another horse—and Salesforce was already galloping to the lead. That was the best business decision I ever made. I soon realized how fast the API was being improved—every few months it got faster and better, with a strong support team and a growing ecosystem of fellow developers. As the owner of a small organization, I've found it amazing to see a company this large so willing to assist: ‘Here's the SDK, can we help you with technical issues—a nd by the way, here'sa trade show that will give you exposure to our customers.' It was impressive.

 

"With salesforce.com's Developer Force, you are always running the latest version, with access to the preview version for testing. If you have questions, you can put them up on one of the forums, with answers both from salesforce.com engineers and other developers. It's very different from .NET, where there's a million places to go, with a million different answers. This is a centralized, tight knit, growing community where people are more than happy to help."

 

The Developer Force offers developers everything related to building, coding, integrating and sharing on demand applications, including a fully-featured salesforce.com Developer Edition account, code samples, discussion boards, webinars and other resources.

 

Apex code opens many doors

Going forward , Wilson plans to keep the DupeBlocker prototype on track with new Apex updates "so that when Apex code is formally announced, we will be ready to go with a tool that will allow you to deduplicate accounts, contacts and leads in a real time environment." Beyond that, he sees plenty of other opportunities with Apex, but is not tipping his hand.

 

There is so much that can be done with Apex because, for the first time, you are dealing with realtime functionality on salesforce.com's servers. That means I can create a single code stream that can be extended to serve hundreds or thousands of organizations. Apex is a powerful development environment that's going to fundamentally change the way people develop for online CRM solutions. 

 

Wilson believes Apex transforms salesforce.com, as well. "If you look at Apex's potential two years down the road, salesforce.com is suddenly playing into a big chunk of the business infrastructure. salesforce.com is already a great CRM system, a great PRM [partner relationship management] system, and a great customer support system. It is incredibly fast, flexible, and multi-tenant. But with a powerful programming language, salesforce.com takes on a greatly expanded new role. As a developer, it gives me an infrastructure—vast in resources yet inexpensive, that I can turn into almost anything I want. salesforce.com has become like an electric company, providing an essential ingredient that you can channel into a million creative applications.

 

"Down the road, for example, you could write a full financial application in Apex, or an entire MRP system—that can be accessed via a browser anywhere in the world. I can't think of a better starting platform to build applications on than that."

 

For other application developers considering Apex code, Wilson suggests beginning with some basic market research. "Begin by talking with salesforce.com administrators and you'll learn their pain points and challenges—any of which can potentially lead to a marketable product. Secondly, check out ideas.salesforce.com for suggestions by salesforce.com users for enhancements to the system. Pick one or two ideas that seem too complex or specialized to be included as part of the main salesforce.com application—and start coding.

 

From a development standpoint, it's easy to begin. Just set up an Developer Force account, download Eclipse and the associated Apex plugin, and start coding. The developer forums are a great way to get assistance as well as to bounce ideas off other developers. In most cases you'll have answers within a few hours.

How do I get started?

The best way to get started is to sign up for the Force.com Free Edition.


Back to top