首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更新DAC扩展

更新DAC扩展
EN

Stack Overflow用户
提问于 2015-06-09 00:11:21
回答 3查看 1.3K关注 0票数 0

我正在尝试通过代码更新DAC扩展中的一些自定义字段,它不是保存到数据库的更改。代码可以很好地检索扩展和数据。我错过了什么-我必须以某种方式使用扩展更新myLS (我以为它会自动这么做)?

代码语言:javascript
复制
myLS = LineItemSerial.Select(); 
INItemLotSerialExt myext = myLS.GetExtension<INItemLotSerialExt>();

myext.UsrFrame1 = "xyz"; 
myext.UsrFrame2 = "zzz"; 
myext.UsrFrame3 = "yyy"; 

LineItemSerial.Update(myLS);
graph.Actions.PressSave();
EN

回答 3

Stack Overflow用户

发布于 2015-06-09 19:57:55

你应该对Acumatica的缓存说你想要更新值:

代码语言:javascript
复制
                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;对于某些情况可以省略,但根据我的经验,这通常是有帮助的。

票数 1
EN

Stack Overflow用户

发布于 2015-06-09 10:11:54

代码语言:javascript
复制
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.

代码语言:javascript
复制
INItemLotSerialExt myext = PXCache<INItemLotSerial>.GetExtension<INItemLotSerialExt>(myLS);

这不是获得扩展的礼仪方式吗?

来自文档

GetExtension(对象)

代码语言:javascript
复制
InventoryItem item = cache.Current as InventoryItem;
InventoryItemExtension itemExt = 
    cache.GetExtension<InventoryItemExtension>(item);

GetExtension(表)

下面的代码获取与基本数据记录的给定实例相对应的扩展数据记录。

代码语言:javascript
复制
InventoryItem item = cache.Current as InventoryItem;
InventoryItemExtension itemExt =
    PXCache<InventoryItem>.GetExtension<InventoryItemExtension>(item);
票数 0
EN

Stack Overflow用户

发布于 2015-06-11 03:34:21

试试这样的..。

代码语言:javascript
复制
    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();
     }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30714177

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档