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
Cesar Ramirez Vasquez005391619375684564Cesar Ramirez Vasquez005391619375684564 

I got this error trying to upsert some records with dataloader Foreign key external ID: 01305906 not found for field Codigo_Factura__c in entity Factura__c

I am upserting 5488 records only 3 fail with the same error anu suggestions ?
Phillip SouthernPhillip Southern
Cesar, have you tried running those 3 records seperately?  What field type is codigo_factura__c ?  Are you're other values you are upserting for, similar to that number listed?
Cesar Ramirez Vasquez005391619375684564Cesar Ramirez Vasquez005391619375684564
Hi codigo_factura__c is the external id and primery key of the object factura; its wear because upsert should create the record but throw that error i dont understand why; by the way im upsertng from .csv file. This is a example of the 3 errors :

NAME CODIGO_FACTURA__C COMPANIA__C EMPRESA_CLIENTE__C FECHA__C MONEDA__C TIPO_DE_CAMBIO__C SUBTOTAL__C IMPUESTO__C ID_VENDEDOR__C NOMBRE_VENDEDOR__C TIPO_DOC__C PERIODO__C DIRECCION__C PLAZO__C DESCUENTO__C TOTAL__C PORC_DESC_ENC__C COD_TIPO_CLIENTE__C DESC_TIPO_CLIENTE__C ERROR
6687 1305906 LABORATORIOS ZEPOL L01-818 30/01/2014 USD 505.12 3000 0 1 GENERAL FP 2014 HEREDIA  DE BURGER KING 1.5 KM ESTE  100 METROS NORTE  CONDOMINIO ALTOS DE PALERMO  CASA 68 180 0 3000  1 CLIENTES NACIONALES Foreign key external ID: l01-818 not found for field Codigo_NAF__c in entity Account

Thats a example of 1 record is failing (remember only 3 fail from the 5488) im stucked here
Logesh VLogesh V
I know this is a very old thread. But just in case some one searches for the error and ends up here.

The answer is based on my understanding and experienc and i am no expert. So if i am wrong anywhere please correct me.

If you are upserting a record along with it's related object's records you must note that the related object's records should already be present. 

Say for Example : Institute is an Object that has Services and Services has Locations.

Now when you are upserting services and want to link it to Institute (Parent Object) during the upsert (using an external id for Insitute) then that record of institute should be already present in salesforce.

So the Upsert is only for service not for Institute. The Institute record will not get inserted during this operation.

In your case Factura__c should have record with external Id 01305906 present for this upsert to go through.