first off i can't thank you enough for this plugin, it was easy to integrate and pretty straight forward. However, although it's not a bug, but probably something im incapable of doing.
we both know Salesforce returns the ID of the record once we create a new record on the SF database, however, i get null. in the logs, i find that this ID is dumped from the file /Plugin/Salesforce/Model/Datasource/SalesforceSource.php line 207.
try {
$response = $this->client->create(array($data), $model->name);`
$this->log("before response");
$this->log($response);
$this->log("after response");
} catch (Exception $e) {
$response->errorMessages = array($e->faultstring, $this->client->getLastRequest());
$this->log("Error in Create: ". $response->errorMessages);
return false;
}
return ($response); //This should return the ID of the created record?
The returned value is in fact the ID of the inserted record, but in my controller when i add a new Contact, the result is a null:
//now, add the user as Contact on Salesforce
$this->loadModel('Salesforce.SalesforceContact');
$this->SalesforceContact->create();
$crm_data = array(
"SalesforceContact" =>
array(
'FirstName' => $data['User']['first_name'],
'LastName' => $data['User']['last_name'],
'Phone' => $data['User']['phone'],
'MailingStreet' => $data['User']['address'],
'MailingCountry' => "Country",
'Email' => $data['User']['email'],
'LeadSource' => 'website',
'Stage__c' => 'Lead',
'TDHC_Webpage_Source__c' => 'contact',
'Website_Counter__c' => $insert_id,
'UTM_Campaign__c' => $data['User']['UTM_Campaign__c'],
'UTM_Content__c' => $data['User']['UTM_Content__c'],
'UTM_Medium__c' => $data['User']['UTM_Medium__c'],
'UTM_Source__c' => $data['User']['UTM_Source__c'],
'UTM_Term__c' => $data['User']['UTM_Term__c'],
)
);
$crm_result = $this->SalesforceContact->saveAll($crm_data);
$this->log($crm_result);
2016-12-16 18:38:15 Error: before response
2016-12-16 18:38:15 Error: Array
(
[0] => stdClass Object
(
[id] => 0032XXXXXXXXb0qAAA
[success] => 1
)
)
2016-12-16 18:38:15 Error: after response
2016-12-16 18:38:15 Error:
See the last line? that's the empty $crm_result, but the previous Datasource file is dumping the correct value.