I have ExternalItemId from CustVendExternalItem table in a custom data entity, which needs to insert a new CustVendExternalItem when a new id is entered in the field. I have overriden the postLoad method for this purpose with the following code:
public void postLoad()
{
super();
CustVendExternalItem custVendExternalItem;
custVendExternalItem.ModuleType = ModuleInventPurchSalesVendCustGroup::VendGroup;
custVendExternalItem.CustVendRelation = "Foreign";
custVendExternalItem.ItemId = this.ItemId;
custVendExternalItem.ExternalItemId = this.ExternalItemId;
custVendExternalItem.InventDimId = InventDim::inventDimIdBlank(); // AllBlank
if (custVendExternalItem.validateWrite())
{
custVendExternalItem.insert();
}
}
But now the data entity throws "The record already exists" error during export or import (It was working before the override).