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?
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!Ayrht46xa1gCV5u908AH4hznZLGU43ysYtYt6Rf7TAdN1NhSQcaw_4FdxCgbR9pUqTLiVW4zlHs5PDITFevblyPg44RCAKRF</urn:sessionId>
</urn:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<urn:create>
<!--Zero or more repetitions:-->
<urn:sObjects xsi:type="urn1:Contract_Sales_Order__c">
<!--Zero or more repetitions:-->
<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>