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…
DuplicateRecordException
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?
Thanks,
Josh