• donnie3iii
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hello,

I am trying to insert a lead using php and running into some trouble. It has been a long time since I have programmed in php so I am attributing this issue to syntax but for thelife of me I can not seem to find any example code.

Here is the code I have tried:

Code:
$fieldsToUpdate
      = array('FirstName'=>$fname,'LastName'=>$lname,'Email'=>$email,'Leadsource'=>$source,'company'=>$co,'Website'=>$web );
$sObject = new SObject();
$sObject->fields = $fieldsToUpdate;
$sObject->type = 'Lead';
$acct = $mySforceConnection->upsert(array ($sObject));

 I have also tried variations like:
Code:
$lead['Email']      = "test@test.com";
$lead['LeadSource'] = "blog";
$lead['Company']    = "Test Co.";
$lead['Website']    = "www.test.com";
$lead['FirstName']  = "Testy";
$lead['LastName']   = "Tester";

$lead['type']       = "Lead";

$result = $mySforceConnection->->create($lead);

//--------------------------------------------------
//Also using the above vars + the following
//--------------------------------------------------

$sObject = new SObject();
$sObject->fields = $lead;
$sObject->type = 'lead';

$result = $mySforceConnection->create($sObject);

 
In my php.ini I do not display the errors so I am not getting any errors back, but when I query the SF I do not see the lead added. I have tried these variations with upsert as well with the same results.

Any help would be most appreciated!

Thanks
Don