Escape Keys - TomdeMan's Blog

A few updates were made in the 0.4 release available at:

salesForceCFC @ riaForge

A major and a minor fix have been implemented. The major being the lack of xmlFormat() in earlier releases. This would prevent characters like '<' to be passed as part of a queryString when using the queryObject() method.

There is now methods to manipulate the timeout value for SOAP requests and a getMemento() method that will return all values stored with the instance.

0.4 -CHANGE LOG- 4/5/2008
- enhancement - added timeout handling for cfhttp
- enhancement - added getMemento()
- fix - added xmlFormat() to query and save methods
- fix - disabled throwonerror for cfhttp to return accurate success

I am on the fence over the throwonerror setting, and looking for some feedback.

Version 0.3 now supports SalesForce's query language, SOQL's, relational queries. Which is their syntax for SQL JOINs. salesForceCFC now has the fields prefixed and built in to the resultset. With an option to include a struct of the entire object with each row.

For more on that, with this release comes the launch of the salesForceCFC demo site.

You'll need a SF account if you don't already have one. Developer account's are free and available at developer.salesforce.com.

v0.3 Change Log & Notes

Download Latest Release of salesForce CFC @ RIAforge.org

I appreciate the positive feedback and suggestions I have received on the initial release of salesForceCFC. So I took the time to put together some stuff that will help implement it.

The latest package includes a landing page, for testing and a link to the cfcdocs.

The test form, will run thru the basic creation of the object, login, and test each method. It is intended to be used as a diagnostic. I added a validate() method, as well. It checks the objects state and looks for an active secure session before trying to send any SOAP requests. The return structs will provide full error information and help you track down the cause quickly.

To download check out the project salesForceCFC at RIAForge

For the latest changes, instructions, and usage notes check out the readme.txt, now included with the package.

salesForceCFC
version: 0.2
date: 3/1/2008

-Overview-
This CFC allows you to connect and work with SalesForce.com,
one of the largest CRMs out there. It does so by generating SOAP requests,
and manipulating their responses.
This will make it easy to work with their SObjects,
and allow you to do more then just query.

-requirements-
ColdFusion 7 or Higher
Salesforce.com Account (Developer Accounts are freely available)

-installation-
1. place salesForceCFC folder inside root
2. browse to folder to run test form or view documentation

-usage-
you can copy the salesForce.cfc into any app and create objects
or map to it and use it from anywhere or in an object factory
remember to init() first, and then login() to activate a session

-note-
becareful with concurrency issues if using mutliple accounts.
it is not meant to be persistent if using more then 1 account.

0.2 -CHANGE LOG-
- feature - added landing page
- feature - added test form
- feature - added cfcDoc
- enhancement - created sendSoapRequest method and updated code
- enhancement - added validate method
- fix - retrieve now returns array of struct for results
- fix - added caching control for cfhttp and soap requests
- deprecated - hasActiveSession()

salesForceCFC

I was given the task to integrate with SalesForce.com, one of the largest CRM companies out there. At first glance, the API documentation on their site, which was at version 11.1 at the time, seemed like it was going to be a simple Webservice integration. Great, that should be fairly easy with CF.

Unfortunately, not. Some work forming the proper headers was going to be an issue. A little bit of google-ing, and I stumbled on a great thread hosted by Adobe. Some familiar names, such as Sean Corfield, were generous enough to post some working sample code. It used the webservice method and was able to query.

However, my goal was to modify data, as well as query. I continued to read on, and found some sample SOAP request code. Which I copied and tried with barely any modification, and was unsuccessful. I have to admit, I did not apply much effort to figuring out why it wasn't working. I had seen the option for a Java integration in the API documentation, and figured I'd be able to pull that off with some CF.

Wrong again. After days of monkeying around with sub-par results, I took it upon myself to find the 'best' solution. By best, I mean simplest, and quickest way to get this project out the door. So I decided to go back and look at the manual SOAP request sample code. It made sense, now its just a matter of getting it to work. I found some sample SOAP requests on the SF site, and went to town.

Finally, I was on a roll. All my requests were working, and responses were as expected. Couldn't stop there. I figured I owed it to the CF Community to take it to the next step. I wanted to make this CF friendly and return data types that would be easy to work with, rather then just SOAP responses. So I took the time to convert the responses over. Returning queries and structs to make things easier.

I hope it helps, and saves some time.

This is the initial release and has a caveat or two: - It is built around an ENTERPRISE account with SF. - It was tested against version 11.1 of the their API.

I will also be adding some documentation soon.

To download check out the project salesForceCFC at RIAForge

Feel free to contact me about any issues, suggestions, or general questions.