-
Request to maintain ttsBegin and ttsCommit in run() method for class SalesCancelOrder in D365fO10.0.43 Update
Issue Description:
In Dynamics finance and operation version -10.0.43 Update, ttsBegin and ttsCommit was added into run() method for class SalesCancelOrder, which is causing custom extension fail.
The custom extension works in lower environment. However, for 10.0.43, it does not
The custom extension requires checking the ttsLevel in SalesUpdateRemain class which get's called when the process is executed.
It is difficult yo review the code with checking the ttsLevel as there are no public/ protected properties available to check if the call was made from the Sales order form for cancellation of the order, as they are making use of "SalesUpdateRemain" class.
Requesting if there is any flight or any way to enable SalesUpdateRemain.parmFormDataSource for extensions to get the value of the form datasource through extension OR there can be a new method so that we can retrieve the caller form's datasource.
Note* the current parm method doesn't follow best practice as it's missing formDataSource assignment (See below)
Current parm method
[Hookable(false)]
public FormDataSource parmFormDataSource(FormDataSource _formDataSource)
{
formDataSource = _formDataSource;
return formDataSource;
}
Proposing either of the below options if possible:
Option # 1: Change below parm method, so they can use it to get value.
[Hookable(false)]
public FormDataSource parmFormDataSource(FormDataSource _formDataSource=formDataSource )
{
formDataSource = _formDataSource;
return formDataSource;
}
Option # 2 - Create a new method to get us the formdatasource:
public FormDataSource getParmFormDataSource()
{
return formDataSource;
}
public class SalesCancelOrder
{
FormRun callerForm;
FormDataSource salesTableFormDataSource;
....
//ttsBegin / ttsCommit introduced in 10.0.43
public void run()
{
List ordersToUpdate = new List(Types::Int64);
MultiSelectionHelper selection = MultiSelectionHelper::construct();
selection.parmDatasource(salesTableFormDataSource);
SalesTable salesTable = selection.getFirst();
SalesLine salesLine;
ProdTable prodTable;
FormDataSource formDataSource;
if (!this.mustCancelSalesOrder())
{
return;
}
if(SalesOrderCancellationContextFlight::instance().isEnabled())
{
ttsbegin;//Got added
using(SalesOrderCancellationContext salesOrderCancellationContext = SalesOrderCancellationContext::construct())
{
this.handleCancellation(salesTable, ordersToUpdate, selection);
}
ttscommit;
}
else
{
this.handleCancellation(salesTable, ordersToUpdate, selection);
}
}
}
Kindly review the options above to confirm if this is possible