mercredi 25 septembre 2019

Salesforce PHP: insert custom object with link to Account

I have a custom object License__c with a link to Account through a Lookup. I'm using a Laravel SF plugin and I need to create a new entry and link it to an existing Account. The account field is required but I can't get SF to accept any combination of field IDs in the custom object and actually create it.

I've used this same method below to create simpler custom objects in the past that didn't have relationships and those work.
Here's what I've tried:

$sfObject = new \StdClass();
$sfObject->Name = 'example name';
$sfObject->Account__c = '<ID>'; // CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY List index out of bounds
$sfObject->Account = '<ID>';// SoapFault with message 'INVALID_FIELD
$account = new StdClass();
$account->Id = '<ID>';
$sfObject->Account__r = $account; // INVALID_FIELD
$sfObject->Account__c = $account; // SoapFault 'Unexpected element during simple type deserialization'
$sfObject->Account__r = array('Id'=>'0012i000003zioKAAQ') // SoapFault INVALID_FIELD: No such column 'item' on entity 'Account'

\Salesforce::create(array($sfObject), 'License__c');


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2nczI2W
via IFTTT

Aucun commentaire:

Enregistrer un commentaire