You need to sign in to do that
Don't have an account?
Superdude
Calling Salesforce From an External Website
I have a contact form on my website and would like to pass info that the users post to salesforce (as a lead) using ajax. Is it possible to do this, and does anyone have an example if it is.
Cheers
Greg H
The easiest solution is would be to use salesforce's Web-To-Lead functionality.
-greg
Superdude
Thanks for the response,
I have just set up a web to lead and everything is working as I wanted. Although, think I'm going to have to use saleforces PHP API for another part of my site - won't just get a way with a web to lead. I need to post leads to salesforce again, but this time I need to intercept the form so that I can save the data to a local database first. If anyone knows a way round this please let me know
Cheers
sfdcfox
You can't post to a foreign server using AJAX (security restriction built into browsers), so the options are either a server-side proxy (like how Salesforce allows access to other sites via SOA), or a CGI application (eg. PHP script) to process the data and then pass the data to Salesforce. The general idea would be to open a socket to port 80 (or 443 for SSL) of Salesforce and then post the data as a form submission. Most languages have a means of doing this without having to go through low-level operations (eg. open socket, bind socket, etc). PHP has a mechanism to do this using just a few lines of code, although the exact syntax escapes me at the moment. Or, you can use the API Toolkit for your language of choice and then use the API to insert or update records in Salesforce; this can help eliminate duplicate entries. Using a proxy format, you'd want to have the AJAX script contact your server, and your server would have a proxy script that goes to Salesforce. That way, security is preserved as far as the browser is concerned, and you can submit to multiple forms at once.
~ sfdcfox ~