Refreshing data source on the calling form in AX 2012

Continue reading

Sometimes there is a need to refresh the calling form’s data source(s) after the operation. For this reason task on the form could be used.

It is just calling the task which stands behind pressing F5 button on the form. There is a macro definition #taskF5 in macro library #Task. This could be done like in example below:

protected void refreshDataSource(Args _args)

{

FormDataSource dataSource;

#Task

if (_args && _args.dataset() && _args.record().isFormDataSource())

{

dataSource = _args.record().dataSource();

if (dataSource.formRun())

{

dataSource.formRun().task(#taskF5);

}

}

}

The example given above is applicable only if there is a single root data source on the refreshed form.

More articles
Explore our blog

Let's talk about your needs!

It will take a moment to fill out the 3-step form and we will contact you to hear your needs.

Thank you for inquiry, we’ve passed it to our sales department, our representative will reach you back in his earliest convenience.

Oops! Something went wrong while submitting the form.