I have created a connection via SOAP with PHP and I am trying to create a new Case when the user submits the form. I have the SFDC Contact ID of the user and I am trying to insert the Contact Id into the Contact field.

Contact is a Lookup(Contact) field.

Here is my code

$sObject = new stdclass();
        $sObject->Contact = '00390000002XUAx';  // Test Victor
        $sObject->Product__c = '01t9000000568wx';  //Test LBD
        $sObject->EventProgram__c = '7016F0000025iQx';  //Test LBD - 15/03/2018
        $sObject->Permission_to_use_in_Marketing__c = 'True';
        $sObject->Description = 'Testing the Case with test text.';
        $sObject->Subject = 'TEST SOAP - F2F Eval';

I am getting the following error:

**** Creating the following: stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [message] => No fields provided in an external foreign key reference in entity: Contact [statusCode] => INVALID_FIELD ) ) [id] => [success] => )

Any help would be greatly appreciated. Thanks.


1 Answer 1


You seem to be populating the Contact Id on Contact whereas the standard Contact lookup field on Case is named as ContactId. And that’s what the error seems to be complaining about as there’s no such field named Contact on Case.

Changing the field to ContactId should resolve your issue. You can find the standard fields on Case in its documentation.

  • 1
    Thank you, that was it. Also that is a great resource, I was looking in SFDC object field list and couldn't see the ContactId field. Oct 3, 2018 at 3:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .