4

With the help of enterprise wsdl, I have been trying to make upsert call in Contact where I need to relate the contact with Account . I have an external Id field on Account and trying to use it for upsert.

I am getting the below Error.

INVALID_TYPE Must send a concrete entity type. -1 -1

Below is the request, I am making....please let me know whats wrong here. I am making this request as sys admin.. and have all permission for this object.

<urn:upsert>
        <urn:externalIDFieldName>Account.Partner_Number_HDS__c</urn:externalIDFieldName>
            <urn:sObjects xsi:type="urn1:Contact"> <!--Zero or more repetitions:--> 
             <FirstName>EnterA</FirstName>
              <LastName>EnterB</LastName>
            <Department>Sales</Department>
            <Job_Title_HDS__c>Account Manager</Job_Title_HDS__c>
            <MobilePhone>456768985</MobilePhone>
            <Email>test@test.com</Email>
            <Account.Partner_Number_HDS__c>PA-74</Account.Partner_Number_HDS__c>   
</urn:sObjects>
</urn:upsert>

Thanks

5

Just played around this and there is unknown property of nesting parent structure in child object to create child object with parent external Id .

Here is the sample Create Call on contact that I tried by passing Account external Id.Please note you can still use create call only no need for upsert as you don't have externalId for contact.

<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>00D90000000aRkL!ARIAQCmb6KJfjySnrTbEZ9HFOvnmDi7UOQTe4OzeTTBsF1mrAiwZXc0aGHM.xQgJ58lwWssBXKBqSlNxWhjVgfk5WQoLQfpB</urn:sessionId>
 </urn:SessionHeader>
 </soapenv:Header>
     <soapenv:Body>
   <urn:create>
     <urn:sObjects xsi:type="urn1:Contact"> <!--Zero or more repetitions:-->
       <!--You may enter ANY elements at this point-->
       <FirstName>Jane</FirstName>
       <LastName>Doe</LastName>
        <urn:Account xsi:type="urn1:Account"> <!--Zero or more repetitions:-Here I have nested Account Structure so that it helps to associate Account directly-> 
         <UID__c>12345</UID__c>
    </urn:Account>
    </urn:sObjects>
 </urn:create>
   </soapenv:Body>
  </soapenv:Envelope>

Here is a small video demonstrating this

Video demonstration

4
  • Thanks Mohith. One more question , how can we do it in case of Custom Object. I have custom object lookup on contact, I need to do the same for that . . Custom object field name is Preferred_Country__c which a lookup to Region__C object....Region object also has a external id. <urn:Preferred_Country_HDS__r xsi:type="urn1:Preferred_Country_HDS__c"> <Test_external_Id__c>India</Test_external_Id__c> </urn:Preferred_Country_HDS__r> – amidstCloud Nov 3 '14 at 6:12
  • Thanks Mohith . .I have resolved this for custom object. btw, Nice video.. – amidstCloud Nov 3 '14 at 6:29
  • Ankit you may like to upvote and mark answered to help others – Mohith Shrivastava Nov 3 '14 at 6:39
  • 1
    Sure. It should help other. I could not find a single example of nested object in Upsert call. – amidstCloud Nov 3 '14 at 6:44
1

Below is the solution to insert the records and populate the Lookup field with the help of external id.

<urn:Account xsi:type="urn1:Account">  
                          <Partner_number_HDS__c>12345</Partner_number_HDS__c>
                </urn:Account>
                <urn:Preferred_Country_HDS__r xsi:type="urn1:Region_HDS__c">  
                       <Test_external_Id__c>India</Test_external_Id__c>
                </urn:Preferred_Country_HDS__r> 

here in first 3 lines,

  i am giving account object external Id Information ,and after that custom oject external Id information...
<urn:Lookupfieldname  xsi:type="urn1:sobjectName">
    <External_Id__c>12312</External_Id__c>
</urn:lookupfieldName>                   

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.