我正在尝试通过代码更新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();
答案 0 :(得分:1)
您应该说要缓存Acumatica要更新的值:
amqp.connect('amqp://' + server + "?heartbeat=5", function(err, conn) {
...
}
NB。 LineItemSerial.Cache.IsDirty = true;对于某些情况可以省略,但根据我的经验,这通常是有帮助的。
答案 1 :(得分:0)
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.
OR
INItemLotSerialExt myext = PXCache<INItemLotSerial>.GetExtension<INItemLotSerialExt>(myLS);
这不是获得延期的礼仪方式吗?
来自文档
GetExtension(对象)
InventoryItem item = cache.Current as InventoryItem;
InventoryItemExtension itemExt =
cache.GetExtension<InventoryItemExtension>(item);
OR
GetExtension(表)
以下代码获取与基础数据记录的给定实例相对应的扩展数据记录。
InventoryItem item = cache.Current as InventoryItem;
InventoryItemExtension itemExt =
PXCache<InventoryItem>.GetExtension<InventoryItemExtension>(item);
答案 2 :(得分:0)
尝试这样的事情......
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();
}