Monthly Archives: February 2008

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.

Getting more than just records from CFQUERY in CF7 and CF8

This might be obvious to some, but the other day I drew a blank, or I thought I did…

I have both CF7 and CF8 running simultaneously on my machine and was doing some debug work with a monster dynamic query. I wanted to grab the rendered SQL from the CFQUERY and just throw it into the DB Client’s Query window. So I dumped the query NAME variable. To my dismay, no SQL, just a resultset.
Where’d it go?

It seems I have been spoiled by CF8, already!

CF7 doesn’t deliver the processed query’s information in the NAME attribute. Instead, you have to set a RESULT attribute to capture the rendered SQL, Execution Time, Record Count, Column List, and the Cached boolean.



select * from tblBlogEntries



CF8, on the other hand, returns both the extended info and the resultset with the NAME attribute. It still accepts a RESULT attribute, which returns the extended info only, as did CF7.

While I was sitting on this entry, a co-worker of mine brought up the same issue. He had found another interesting method of retrieving the generated SQL.

Place a CFABORT inside the CFQUERY. It will treat the CFQUERY tags like a CFOUTPUT, and render whatever you have up to the CFABORT and present it as plain-text.

Give it a try.



select #variables.columnList# from tblBlogEntries

OUTPUT: select * from



select #variables.columnList# from tblBlogEntries


OUTPUT: select * from tblBlogEntries