Acumatica - Copy last row

后端 未结 3 1850
眼角桃花
眼角桃花 2021-01-26 03:59

So looks like seemingly easy things in Acumatica are terribly complicated to implement. All I wanna do is to copy last row of my grid as a new one. I would like the user to pers

3条回答
  •  庸人自扰
    2021-01-26 05:02

    The code should be like this:

    public PXAction copyLastRow;
    [PXUIField(DisplayName = "Copy Last Row", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
    [PXProcessButton]
    public virtual IEnumerable CopyLastRow(PXAdapter adapter)
    {
        SOLine line = Base.Transactions.Select().LastOrDefault();
        SOLine newLine = new SOLine();
        ... (copy all you need from line to newLine)
        Base.Transactions.Cache.Insert(newLine);           
        Base.Actions.PressSave();
        return adapter.Get();
    } 
    

提交回复
热议问题