Acumatica - Copy last row

后端 未结 3 1868
眼角桃花
眼角桃花 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:03

    If you just want to take the line and copy all values you can use cache copy and null the lineid. Then on insert of the copied line it will get the next linenbr automatically... adding to your sample code in your question...

    SOLine line = Base.Transactions.Select().LastOrDefault();
    var copy = (SOLine)Base.Transactions.Cache.CreateCopy(line);
    copy.LineNbr = null;
    Base.Transactions.Cache.Insert(copy);
    

    This method should also be upgrade friendly in the event new fields or customization are added to SOLine they will continue to be copied without having to selectively include all fields to be copied (using CreateCopy).

提交回复
热议问题