我正在尝试通过代码更新DAC扩展中的一些自定义字段,它不是保存到数据库的更改。代码可以很好地检索扩展和数据。我错过了什么-我必须以某种方式使用扩展更新myLS (我以为它会自动这么做)?
myLS = LineItemSerial.Select();
INItemLotSerialExt myext = myLS.GetExtension<INItemLotSerialExt>();
myext.UsrFrame1 = "xyz";
myext.UsrFrame2 = "zzz";
myext.UsrFrame3 = "yyy";
LineItemSerial.Update(myLS);
graph.Actions.PressSave();发布于 2015-06-09 19:57:55
你应该对Acumatica的缓存说你想要更新值:
LineItemSerial.Cache.SetValueExt(myLS , "UsrFrame1", "xyz");
LineItemSerial.Cache.SetValueExt(myLS , "UsrFrame2 ", "zzz");
LineItemSerial.Cache.SetStatus(myLS , PXEntryStatus.Modified);
LineItemSerial.Cache.Update(myLS);
LineItemSerial.Cache.IsDirty = true;注意:LineItemSerial.Cache.IsDirty = true;对于某些情况可以省略,但根据我的经验,这通常是有帮助的。
发布于 2015-06-09 10:11:54
INItemLotSerialExt myext = LineItemSerial.GetExtension<INItemLotSerialExt>(myLS); //if LineItemSerial is a view related to the DAC. I hope LineItemSerial is a public view defined in the graph as you are trying to save the changes when u press the save of graph.或
INItemLotSerialExt myext = PXCache<INItemLotSerial>.GetExtension<INItemLotSerialExt>(myLS);这不是获得扩展的礼仪方式吗?
来自文档
GetExtension(对象)
InventoryItem item = cache.Current as InventoryItem;
InventoryItemExtension itemExt =
cache.GetExtension<InventoryItemExtension>(item);或
GetExtension(表)
下面的代码获取与基本数据记录的给定实例相对应的扩展数据记录。
InventoryItem item = cache.Current as InventoryItem;
InventoryItemExtension itemExt =
PXCache<InventoryItem>.GetExtension<InventoryItemExtension>(item);发布于 2015-06-11 03:34:21
试试这样的..。
ContractExtension cExt = PXCache<PMProject>.GetExtension<ContractExtension>(project);
ARInvoiceEntry graph = PXGraph.CreateInstance<ARInvoiceEntry>();
graph.Document.Current = graph.Document.Search<ARInvoice.projectID, ARInvoice.docDate>(projectID.Value, invoiceDate.Value);
if(graph.Document.Current !=null)
{
ARInvoice i = graph.Document.Current;
i.InvoiceNbr = cExt.CustomerPO;
graph.Document.Update(i);
graph.Actions.PressSave();
}https://stackoverflow.com/questions/30714177
复制相似问题