Load value from popup to InventoryID field

拥有回忆 提交于 2019-12-11 16:52:24

问题


am generating a pop on one new button click in stock Items screen, inside popup have two buttons, user select some data from fields in the popup and then click on ok, then inventoryId should be formed with some special characters and then it should display in InventoryID field. I can form the InventoryID but unable to display it in InventoryID field.

    [PXButton]
    [PXUIField(DisplayName = "Generate")]
    public virtual void GenerateInv()
    {
        InventoryItemExt ext = Base.Item.Cache.GetExtension<InventoryItemExt>(Base.Item.Current);

        Base.Item.Current.InventoryCD = ext.UsrInvId;
        Base.Item.Cache.Insert(Base.Item.Current);
    }

回答1:


I had this issue before, and the following code was provided by acumatica. you may try the same. here in the below code, inventoryCD contains the value, i wanted to set.

  InventoryItem item = PXCache<InventoryItem>.CreateCopy(Base.Item.Current);

  OrderedDictionary keys = new OrderedDictionary(StringComparer.OrdinalIgnoreCase) 
                {
                    {
                        typeof(InventoryItem.inventoryCD).Name, 
                        adapter.View.Cache.GetValue(adapter.View.Cache.Current, 
                        typeof(InventoryItem.inventoryCD).Name)
                    }
                };
                    OrderedDictionary vals = new OrderedDictionary(StringComparer.OrdinalIgnoreCase) 
                { 
                    { 
                        typeof(InventoryItem.inventoryCD).Name, inventoryCD 
                    } 
                };
                    adapter.View.Cache.Update(keys, vals);
                    if (adapter.Searches != null && adapter.Searches.Length > 0)
                    {
                        adapter.Searches[0] = inventoryCD;
                        }    
  return adapter.Get();

Also make sure your function have the correct input and the return type

 IEnumerable GenerateInv(PXAdapter adapter)  


来源:https://stackoverflow.com/questions/48503389/load-value-from-popup-to-inventoryid-field

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!