Duplicate Row Error - New insert into UD Table

Does anyone know why I would receive a “Duplicate Row Error” while trying to insert a new record into a UD table? The record certainly doesn’t exist as I search the UD table for the Key1 value.

Here’s my code…

public static void SyncUD16(Erp.ErpContext dbContext, string partNum)
	UD16Tableset ud16TS = new UD16Tableset();

	using (UD16SvcContract ud16 = Ice.Assemblies.ServiceRenderer.GetService<UD16SvcContract>(dbContext))
		ud16.GetaNewUD16(ref ud16TS);
		ud16TS.UD16[0].Key1 = partNum;

		ud16.Update(ref ud16TS);

Upon trying to update, I get the following error…

Description: This is a duplicate entry of an existing record
Program: Epicor.Ice.dll
Method: CreateRow
Line Number: 1143
Column Number: 21
Table: UD16

Not sure what else I need to set after calling the ud16.GetaNewUD16(ref ud16TS) method.

Any ideas?



First guess would be to check if the partNum variable has a value. If it is blank, it is possible that there is also a blank value in the UD16 table.