Sorry that I have not responded, but I am dealing with a health issue at the moment. I have a pinched nerve in my neck that has basically left my left arm unusable.
I will do my best to help you out and may ask you some questions along the way. You can do what you are asking because you want to insert some information on a form that is filled out on your site. So here is your scenario, which is my best guess.
1) A user is registering on your site and submitting a form that is stored in either a post array or in a get array, am I correct there?
2) To insert those fields into an object/table in Salesforce you would do something like the following:
3) Let's say your salesforce object is lead account object and want to create a record with your data:
PHP Code:
//this uses another script which has a $client array of your login to salesforce which you can user in any of
//salesforce scripts. posted above
require_once ('/users/msimonds/public_html/includes/sfdc.inc');
//create an array name that you are going to insert using as your data array
$data_array = array();
//these fields in the data_array must match your API names on fields such as custom fields
$data_array['field_one'] = $_POST['field_one'];
$data_array['field_two'] = $_POST['field_two'];
//example of custom field
$data_array['custom_field__c'] = $_POST['field_three'];
//now you want to create the salesforce object to create your record in your object
$sObject = new sObject();
//the Sobject type is the name of the object that you are going to insert the record too
$sObject->type = 'Lead';
// this is the $data_array that you setup above with the fields
$sObject->fields = $project;
//This creates the record from the $Sobject
$result = $client->create(array($sObject));
//do something with the result object when it comes back
if ($result->success)
{
echo 'record created';
}
else
{
echo 'creation failed';
}
Here is a small script that you can modify to use in any of your scripts that logs in to salesforce and gives you one central location for your username and password and makes it a whole lot easier to control your login credentials.
make sure you change the paths to your partner client and WSDL and call this sfdc.inc. You will see this in the code above being called first
PHP Code:
<?php
require_once ('/users/msimonds/public_html/includes/soapclient/SforcePartnerClient.php');
require_once ('/users/msimonds/public_html/includes/soapclient/SforceHeaderOptions.php');
// Login to salesforce.com
$login = "you@email.com";
$password = "password";
$wsdl = "/users/msimonds/public_html/includes/soapclient/partner.wsdl.xml";
$client = new SforcePartnerClient();
$client->createConnection($wsdl);
try
{
$loginResult = $client->login($login, $password);
if ($loginResult->passwordExpired)
{
$client = null;
}
}
catch (exception $e)
{
$client = null;
}
?>
see if this makes any sense and will help you, it should give you an idea of what needs to be done. I will check back to see if this helps at all
Again sorry for the delay
~Mike
Bookmarks