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
Albert HernandezAlbert Hernandez 

Issue with upsert to custom object ‘Account_Balance_by_Entity’ which has Account__c as Lookup fields.

Hi,

We are facing an issue in our production environment for one of the customer while sending data to Salesforce to upsert the custom object ‘Account_Balance_by_Entity’ which has Account__c as Lookup field.

For example, we are getting the error  “Attempting to update (as part of an upsert) parent field Account__c with new value 001E000000BsqzVIAR, current value is 001E000000BsqzvIAB”.

It is noticeable that two accounts have unique Id(from url) with same order of alphanumeric combinations, one ending with lower case and another upper case.
One account has ID like 001E000000BsqzV and another like 001E000000Bsqzv.
Everything are in same order, only one ends with upper case 'V' and another ends with lower case 'v'.

We send the ‘upsert’ request to SFDC which has 001E000000BsqzV and get error for another similar ID 001E000000Bsqzv. There are many such combination of accounts in our customer’s Salesforce company.
Could you please suggest us how to fix this issue?

Any account which does not have similar other account Id then posting works fine.

Few details about custom object:
Object Name:    Account_Balance_by_Entity
API Name:          Account_Balance_by_Entity__c

Standard Fields:
Label                                     Field Name         Data Type           
Created By                          CreatedBy           Lookup(User)    
Currency                              CurrencyIsoCode             Picklist 
Intacct Entity Name        Name                    Text(80)               
Last Modified By              LastModifiedBy Lookup(User)    
Owner                                  Owner                  Lookup(User,Queue)

Custom Fields & Relationships
Field Label           API Name            Data Type                           
Account               Account__c        Lookup(Account)
Balance                Balance__c         Currency(16, 2)
External Id          External_Id__c Text(80) (External ID) (Unique Case Insensitive)

Here is the XML request and response:
Request:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:partner.soap.sforce.com" xmlns:ns2="urn:sobject.partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <SOAP-ENV:Header>
      <ns1:SessionHeader>
         <ns1:sessionId>******SessionId here***** </ns1:sessionId>
      </ns1:SessionHeader>
      <ns1:CallOptions>
         <ns1:client>Intacct/1.0</ns1:client>
         <ns1:defaultNamespace xsi:nil="true" />
      </ns1:CallOptions>
   </SOAP-ENV:Header>
   <SOAP-ENV:Body>
      <ns1:upsert>
         <ns1:externalIDFieldName>External_Id__c</ns1:externalIDFieldName>
         <ns1:sObjects>
            <ns2:type>Account_Balance_by_Entity__c</ns2:type>
            <ns2:Id xsi:nil="true" />
            <Account__c>001E000000BsqzVIAR</Account__c>
            <Name>ACC-US--Accruent USA</Name>
            <CurrencyIsoCode>USD</CurrencyIsoCode>
            <Balance__c>10243</Balance__c>
            <External_Id__c>001E000000BsqzV--ACC-US</External_Id__c>
         </ns1:sObjects>
      </ns1:upsert>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Response:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <upsertResponse>
         <result>
            <created>false</created>
            <errors>
               <fields>Account__c</fields>
               <message>Attempting to update (as part of an upsert) parent field Account__c with new value 001E000000BsqzVIAR, current value is 001E000000BsqzvIAB</message>
               <statusCode>INVALID_FIELD_FOR_INSERT_UPDATE
</statusCode>
            </errors>
            <id xsi:nil="true" />
            <success>false</success>
         </result>
      </upsertResponse>
   </soapenv:Body>
</soapenv:Envelope>



<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
logontokartiklogontokartik
I dont think the Account Ids are same, in Salesforce the IDs are 15 character case sensitive and 18 case Insensitive, so even if you take the Account Id one with lower case and one with upper case they are different.

Have you confirmed if they are different or same, by checking them in Salesforce? 
Albert HernandezAlbert Hernandez
Thanks logontokartik,

Yes, I have confirmed that these accounts are different in Salesforce.

Could you please elaborate and explain, what does it mean by
“in Salesforce the IDs are 15 character case sensitive and 18 case Insensitive”
Forza di SognoForza di Sogno
You should probably use the case-safe 18-digit version of the ID.  Create a formula field (e.g. "ID_Case_Safe") with CASESAFEID(ID) and use that instead of the regular Id.