Sunday, April 11, 2021

How to refresh form datasource from Class or Table in D365fo

// If this is a data source on a form, then refresh from table in AX7 / D365.
if (FormDataUtil::isFormDataSource(this))
{
	FormDataUtil::getFormDataSource(this).refresh();
}


Refresh from data source from class in AX7 / D365
Table tableBuffer;
FormDataSource formDataSource;
tableBuffer = _args.record();
formDataSource = FormDataUtil::getFormDataSource(tableBuffer);
formDataSource.research();

Refresh from data source from class in AX7 / D365 from workflow
I just wrote couple of custom workflow. But on Submit workflow, form did not refresh and available for edit until, you manually refresh the form. That behavior is certainly not acceptable by end user.

usually _args.caller().updateWorkflowControls(); will do this. Possible I missed something. But for its solution I add following code snippet for data set refresh that works for me.

dssRfpTable tableBuffer = _args.record();
FormDataSource custInvoiceTableDataSource;
custInvoiceTableDataSource = FormDataUtil::getFormDataSource(tableBuffer);

 

if (custInvoiceTableDataSource)
{
custInvoiceTableDataSource.research(true);
custInvoiceTableDataSource.refresh();
}

No comments:

Post a Comment

Table browser URL in D365FO

Critical Thinking icon icon by Icons8