function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Snehil22Snehil22 

Error while updating custom object lookup using external id using SOAP API request

I am trying to update a Custom object lookup using SOAP API by passing an external Id.

While doing that I am getting an error

Invalid foreign key relationship name Service_Maintenance_Contract__r

Service_Maintenance_Contract__c field is the lookup on SVMXC__Service_Contract__c object. Contract_Number__c is an external Id field on SVMXC__Service_Contract__c.

Note: I tried updating a Standard Object(Account) lookup using a similar process and it got updated successfully.

Wanted to know if there is a limitation with custom objects or is there any alternate way of doing this.

Thanks,

Snehil

Below is the SOAP request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com" xmlns:urn1="urn:sobject.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header>
      
      <urn:SessionHeader>
         <urn:sessionId>00Dn0000000DmLK!ARYAQHnxa1gCV5u6I8AH4fhdrweGU43ysYtYt6Rf7TAdN1NhSQcaw_4FdxCgbR9pUqTLiVW4zlHs5PDITFevblyPg44RCAKRF</urn:sessionId>
      </urn:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      
      <urn:create>
    <!--Zero or more repetitions:-->
 
        <urn:sObjects xsi:type="urn1:Contract_Sales_Order__c">   
        <urn1:Oracle_Sales_Order_Number__c>54321</urn1:Oracle_Sales_Order_Number__c>
                         
        <urn1:Service_Maintenance_Contract__r xsi:type="urn1:SVMXC__Service_Contract__c">
        <Contract_Number__c>21312033</Contract_Number__c>
        </urn1:Service_Maintenance_Contract__r>
       
      </urn:sObjects>
      </urn:create>
   </soapenv:Body>
</soapenv:Envelope>