Hi,
I'm attempting a modification to the SalesCreateReleaseOrder form with the intention that a user can filter the order lines and then using a multiselect, ask AX to create a release order with the sales quantity automatically pulled from the corresponding sales line.
So far, I have added a new field to SalesCreateReleaseOrderLineTmp, the temporary table that the form uses as a datasource called SalesLineSalesQty, which carries the SalesQty from the corresponding SalesLine entry. I now want the user to select one or more records and then click a button. This would then copy the value from SalesCreateReleaseOrderLineTmp.SalesLineSalesQty into SalesCreateReleaseOrderLineTmp.SalesQty.
However, when attempting to do this, I get an error -
Cannot edit a record in Order lines (SalesCreateReleaseOrderLineTmp).
The record has never been selected.
The code that I'm using (on the form button) is:
void clicked()
{
MultiSelectionHelper selectionHelper = MultiSelectionHelper::construct();
SalesCreateReleaseOrderLineTmp orderLineTmp;
super();
selectionHelper.parmDataSource(SalesCreateReleaseOrderLineTmp_ds);
orderLineTmp = selectionHelper.getFirst();
while (orderLineTmp){
ttsbegin;
orderLineTmp.selectForUpdate(true);
orderLineTmp.SalesQty = orderLineTmp.SalesLineSalesQty;
orderLineTmp.update();
ttscommit;
orderLineTmp = selectionHelper.getNext();
}
SalesCreateReleaseOrderLineTmp_ds.reread();
SalesCreateReleaseOrderLineTmp_ds.refresh();
}
Is anyone able to assist please?