We would like to copy current row in acumatica via button in Purchase Orders screen. I asked question about that earlier in Acumatica - Copy last row
None of the solutions work anymore in 2020 R1, build 20.104.0012. It appears that NoteID needs to be set to null, in addition to line ID. Ilya's solution in the link above does not create the second line at all, after the PressSave is run. Brandon's solution generates "An item with the same key has already been added." error. My updated action is below:
public PXAction<POOrder> copyRow;
[PXButton]
[PXUIField(DisplayName = "Copy Row")]
protected virtual IEnumerable CopyRow(PXAdapter adapter)
{
var row = Base.Transactions.Current;
var rowCopy = Base.Transactions.Cache.CreateCopy(row) as POLine;
rowCopy.LineNbr = null;
rowCopy.NoteID = null;
rowCopy = Base.Transactions.Insert(rowCopy);
return adapter.Get();
}
Please advise.