You need to sign in to do that
Don't have an account?
ldtech
Simple connection to Salesforce as external database
I'm working with a customer that uses salesforce currently and would like to add a few features onto their web site product (that we've developed) that interact with some data that's stored in their salesforce account.
My question is, I'm working with Coldfusion which doesn't appear to have any packages for salesforce so I was wondering if it's possible to do a simple connection with AJAX in order to draw down and update some of their data. I was reviewing some of the AJAX proxy options and think that this would be the route I would go down, but other than the AJAX Proxy page I can't find any more information on how to get started with this and get it setup.
Some of the problems I'm having is finding a link to a javascript library that they seem to reference when doing their AJAX call connection and finding some basic instruction other than what they've got on that proxy page. It seems pretty simple once I've got the library and connection instructions (if that's all there is to it) but I'd like to know if there's anything else I need to ramp up on before jumping into this headlong.
I've got about a week to show some decent progress and we'd like to have it up and running (doing updates to salesforce and drawing data down) in about a month. Is this a reasonable expectation?
My question is, I'm working with Coldfusion which doesn't appear to have any packages for salesforce so I was wondering if it's possible to do a simple connection with AJAX in order to draw down and update some of their data. I was reviewing some of the AJAX proxy options and think that this would be the route I would go down, but other than the AJAX Proxy page I can't find any more information on how to get started with this and get it setup.
Some of the problems I'm having is finding a link to a javascript library that they seem to reference when doing their AJAX call connection and finding some basic instruction other than what they've got on that proxy page. It seems pretty simple once I've got the library and connection instructions (if that's all there is to it) but I'd like to know if there's anything else I need to ramp up on before jumping into this headlong.
I've got about a week to show some decent progress and we'd like to have it up and running (doing updates to salesforce and drawing data down) in about a month. Is this a reasonable expectation?
Look under Working with the AJAX Toolkit -> Connecting to the API for a URL for the connection library.
HTH
Message Edited by jpizzala on 04-14-2008 10:15 AM
It would probably be a lot easier just to connect ColdFusion to the Salesforce web services API. See this blog post for a start on it:
http://blog.webdh.com/index.cfm/2007/10/11/Using-CF-to-create-a-Lead-in-SalesForce-using-SOAP
<cffunction name="SFLogin">
<cfargument name="userName" required="yes" type="string">
<cfargument name="password" required="yes" type="string">
<cfargument name="wsdl" required="yes" type="string">
<cfset sfdc = createObject("webservice","#wsdl#") />
<cfset result = sfdc.login("#ARGUMENTS.userName#","#ARGUMENTS.password#") />
<!--- create a SOAPHeaderElement called SessionHeader in the SforceService
namespace: --->
<cfset authHeader = createObject("java","org.apache.axis.message.SOAPHeaderElement").init("SforceService", "SessionHeader") />
<!--- add (and populate) a text node called sessionId: --->
<cfset authHeader.addChildElement("sessionId").addTextNode(result.getSessionId()) />
<!--- set the entire soap header: --->
<cfset sfdc.setHeader(authHeader) />
<!--- change the endpoint URL to what was returned by the login method: --->
<cfset sfdc._setProperty("javax.xml.rpc.service.endpoint.address",result.getServerURL()) />
<cfset result = sfdc.getUserInfo() />
<cfreturn sfdc>
</cffunction>
<cfinvokeargument name="strUsername" value="abc" />
<cfinvokeargument name="strPassword" value="1234" />
<cfinvokeargument name="wsdl" value="http://myserver/mysite/Salesforce/enterprise.xml?wsdl" />
</cfinvoke>
mike
Hi,
I have got the ServiceInvocationException fixed. I concatinated the security token to my password and it worked without any error. I have removed the "?wsdl" from the http://myserver/mysite/Salesforce/enterprise.xml?wsdl file path.
When returning the value from sfdc from the function its returning me coldfusion.xml.rpc.ServiceProxy@1b26f42 as output.
I would just like to get the login success/failure status as my output from the SFLogin function. I am then looking at creating / updatign an object for contact in salesforce.
Can you help me with some sample code for creating / updating a Contact.
Thanks,
Kathryn
Once you have the binding to Salesforce you can then call all the API methods on it. Use the API documentation for info on the available methods.
So to create a contact you have something like this with Enterprise wsdl:
aContact = StructNew();
aContact.type = "Contact";
aContact name = "Jon Doe";
sObjs = arraynew(1);
sObjs[1] =aContact;
sfdc.create(sObjs);
If you reply to teracotta@sbcglobal.net I'll send you a CF library that abstracts dealing with salesforce in CF (designed to work with the partner wsdl).
Mike