0
votes

I am trying to create a new Contact object on Salesforce when our customer inputs their info in WordPress form.

What I notice is I am able to create Lead, Account, etc, but not Contact Object in particular.

The AccountId and LastName fields are the only required field in the Organization's Contact. By the fact that I'm able to create Lead and Account, I'm assuming connection parts are working fine.

$contact = new stdClass();
$contact->type = "Contact";
$contact->fields = array(  
    "AccountId" => '0016F00002OcBIMQA3', 
    "RecordTypeId" => '0126F000001hG2WQAU',
    "LastName" => "test",

);

try {  
    $result = $sforce_connection->create(array($contact));  
    var_dump($result);  

} catch (Exception $e) {  
    var_dump($e);  
}

There are no error messages coming up. There's no error, except, new contact is not created.

1

1 Answers

0
votes

I must admit I have not tried to use php for this. However, in a SOQL query the AccountId is rejected and you instead simply type contact.Account not contact.AccountId. Is it possible that the same problem exists here? Have you tried

$contact->fields = array(  
    "Account" => '0016F00002OcBIMQA3', 
    "RecordType" => '0126F000001hG2WQAU',
    "LastName" => "test",

);