我正在尝试通过Salesforce中的REST API进行批量upsert,但是我收到以下错误:
<results xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<result>
<errors>
<message>duplicate value found: ID_Externo__c duplica o valor no registro com ID: 0014B00000RKZkR
</message>
<statusCode>DUPLICATE_VALUE</statusCode>
</errors>
<success>false</success>
<created>true</created>
</result>
<result>
<errors>
<message>duplicate value found: ID_Externo__c duplica o valor no registro com ID: 0014B00000RKZkP
</message>
<statusCode>DUPLICATE_VALUE</statusCode>
</errors>
<success>false</success>
<created>true</created>
</result>
<result>
<errors>
<message>duplicate value found: ID_Externo__c duplica o valor no registro com ID: 0014B00000RKZkS
</message>
<statusCode>DUPLICATE_VALUE</statusCode>
</errors>
<success>false</success>
<created>true</created>
</result>
<result>
<errors>
<fields>ID_Externo__c</fields>
<message>Duplicate external id specified: 062.203.686-6501237000000RgoCAAS
</message>
<statusCode>DUPLICATE_VALUE</statusCode>
</errors>
<success>false</success>
<created>false</created>
</result>
<result>
<errors>
<message>duplicate value found: ID_Externo__c duplica o valor no registro com ID: 0014B00000RKZkT
</message>
<statusCode>DUPLICATE_VALUE</statusCode>
</errors>
<success>false</success>
<created>true</created>
</result>
<result>
<errors>
<message>duplicate value found: ID_Externo__c duplica o valor no registro com ID: 0014B00000RKZkU
</message>
<statusCode>DUPLICATE_VALUE</statusCode>
</errors>
<success>false</success>
<created>true</created>
</result>
<result>
<errors>
<fields>ID_Externo__c</fields>
<message>Duplicate external id specified: 062.203.686-6501237000000RgoCAAS
</message>
<statusCode>DUPLICATE_VALUE</statusCode>
</errors>
<success>false</success>
<created>false</created>
</result>
<result>
<errors>
<message>duplicate value found: ID_Externo__c duplica o valor no registro com ID: 0014B00000RKZkV
</message>
<statusCode>DUPLICATE_VALUE</statusCode>
</errors>
<success>false</success>
<created>true</created>
</result>
<result>
<errors>
<message>duplicate value found: ID_Externo__c duplica o valor no registro com ID: 0014B00000RKZkW
</message>
<statusCode>DUPLICATE_VALUE</statusCode>
</errors>
<success>false</success>
<created>true</created>
</result>
<result>
<errors>
<message>duplicate value found: ID_Externo__c duplica o valor no registro com ID: 0014B00000RKZkX
</message>
<statusCode>DUPLICATE_VALUE</statusCode>
</errors>
<success>false</success>
<created>true</created>
</result>
</results>
在我的请求中,我没有发送重复值(除了我为测试创建的值,并且得到正确的错误 - 指定了重复的外部ID)。
这是我的要求:
<sObjects xmlns="http://www.force.com/2009/06/asyncapi/dataload" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<sObject>
<CPF_CNPJ__c>672.334.062-00</CPF_CNPJ__c>
<Name>672.334.062-00</Name>
<RecordType>
<sObject>
<Name>Cliente Varejo</Name>
</sObject>
</RecordType>
<Clear__c>true</Clear__c>
<ID_Externo__c>672.334.062-0001237000000RgoCAAS</ID_Externo__c>
</sObject>
<sObject>
<CPF_CNPJ__c>035.621.729-90</CPF_CNPJ__c>
<Name>035.621.729-90</Name>
<RecordType>
<sObject>
<Name>Cliente Varejo</Name>
</sObject>
</RecordType>
<Clear__c>true</Clear__c>
<ID_Externo__c>035.621.729-9001237000000RgoCAAS</ID_Externo__c>
</sObject>
<sObject>
<CPF_CNPJ__c>303.292.018-32</CPF_CNPJ__c>
<Name>303.292.018-32</Name>
<RecordType>
<sObject>
<Name>Cliente Varejo</Name>
</sObject>
</RecordType>
<Clear__c>true</Clear__c>
<ID_Externo__c>303.292.018-3201237000000RgoCAAS</ID_Externo__c>
</sObject>
<sObject>
<CPF_CNPJ__c>062.203.686-65</CPF_CNPJ__c>
<Name>062.203.686-65</Name>
<RecordType>
<sObject>
<Name>Cliente Varejo</Name>
</sObject>
</RecordType>
<Clear__c>true</Clear__c>
<ID_Externo__c>062.203.686-6501237000000RgoCAAS</ID_Externo__c>
</sObject>
<sObject>
<CPF_CNPJ__c>054.454.224-02</CPF_CNPJ__c>
<Name>054.454.224-02</Name>
<RecordType>
<sObject>
<Name>Cliente Varejo</Name>
</sObject>
</RecordType>
<Clear__c>true</Clear__c>
<ID_Externo__c>054.454.224-0201237000000RgoCAAS</ID_Externo__c>
</sObject>
<sObject>
<CPF_CNPJ__c>845.374.266-91</CPF_CNPJ__c>
<Name>845.374.266-91</Name>
<RecordType>
<sObject>
<Name>Cliente Varejo</Name>
</sObject>
</RecordType>
<Clear__c>true</Clear__c>
<ID_Externo__c>845.374.266-9101237000000RgoCAAS</ID_Externo__c>
</sObject>
<sObject>
<CPF_CNPJ__c>062.203.686-65</CPF_CNPJ__c>
<Name>062.203.686-65</Name>
<RecordType>
<sObject>
<Name>Cliente Varejo</Name>
</sObject>
</RecordType>
<Clear__c>true</Clear__c>
<ID_Externo__c>062.203.686-6501237000000RgoCAAS</ID_Externo__c>
</sObject>
<sObject>
<CPF_CNPJ__c>041.235.286-94</CPF_CNPJ__c>
<Name>041.235.286-94</Name>
<RecordType>
<sObject>
<Name>Cliente Varejo</Name>
</sObject>
</RecordType>
<Clear__c>true</Clear__c>
<ID_Externo__c>041.235.286-9401237000000RgoCAAS</ID_Externo__c>
</sObject>
<sObject>
<CPF_CNPJ__c>258.419.948-32</CPF_CNPJ__c>
<Name>258.419.948-32</Name>
<RecordType>
<sObject>
<Name>Cliente Varejo</Name>
</sObject>
</RecordType>
<Clear__c>true</Clear__c>
<ID_Externo__c>258.419.948-3201237000000RgoCAAS</ID_Externo__c>
</sObject>
<sObject>
<CPF_CNPJ__c>126.912.867-11</CPF_CNPJ__c>
<Name>126.912.867-11</Name>
<RecordType>
<sObject>
<Name>Cliente Varejo</Name>
</sObject>
</RecordType>
<Clear__c>true</Clear__c>
<ID_Externo__c>126.912.867-1101237000000RgoCAAS</ID_Externo__c>
</sObject>
</sObjects>
字段“ID_Externo__c”是独占,区分大小写和外部ID。 如果我禁用独占标记,则upsert调用会复制注册表;而且,如果我试图再次将该字段设为独占,那么Salesforce会给我一个错误,即发现重复的外部ID。
由于
答案 0 :(得分:0)
你有ID_Externo_c:062.203.686-6501237000000RgoCAAS引用了两次:第4和第7条记录。