I'm attempting to insert an INKitRegister
item. Here's the code:
KitAssemblyEntry kitGraph = CreateInstance<KitAssemblyEntry>();
INKitRegister kit = new INKitRegister();
kitGraph.Document.Current = kit;
kitGraph.Document.Cache.SetValueExt<INKitRegister.inventoryID>(kit, mixQLine.InventoryID);
// This line is not working
kitGraph.Document.Cache.SetValueExt<INKitRegister.locationID>(kit,
scales.LocationID);
kitGraph.Document.Cache.SetValueExt<INKitRegister.uOM>(kit, mixQLine.Uom);
kitGraph.Document.Cache.SetValueExt<INKitRegister.qty>(kit, mixQLine.Qty);
kit = kitGraph.Document.Cache.Update(kit) as INKitRegister;
kitGraph.Actions.PressSave();
If I manually configure the InventoryItem to have a default location assigned, the item inserts properly for all other fields, but if not, it throws this error:
Error: Inserting 'IN Kit Split' record raised at least one error. Please review the errors.
What am I doing wrong?
'The errors':
9/11/2020 2:36:26 PM Error: Error: Inserting 'IN Kit Split' record raised at least one error. Please review the errors. at PX.Data.PXUIFieldAttribute.CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e) at PX.Data.PXCache.OnCommandPreparing(String name, Object row, Object value, PXDBOperation operation, Type table, FieldDescription& description) at PX.Data.PXProjectionAttribute.PersistInserted(PXCache sender, Object row) at PX.Data.PXCache.PersistInserted(Object row, Boolean bypassInterceptor) at PX.Data.PXCache.Persist(PXDBOperation operation) at PX.Data.PXGraph.Persist(Type cacheType, PXDBOperation operation) at PX.Data.PXGraph.Persist() at PX.Data.PXSave.d__2.MoveNext() at PX.Data.PXAction.d__28.MoveNext() at PX.Data.PXAction.d__28.MoveNext() at PX.Web.UI.PXBaseDataSource.tryExecutePendingCommand(String viewName, String[] sortcolumns, Boolean[] descendings, Object[] searches, Object[] parameters, PXFilterRow[] filters, DataSourceSelectArguments arguments, Boolean& closeWindowRequired, Int32& adapterStartRow, Int32& adapterTotalRows) at PX.Web.UI.PXBaseDataSource.ExecuteSelect(String viewName, DataSourceSelectArguments arguments, PXDSSelectArguments pxarguments)