Dynamics AX Blog - sysoperation-framework - Posts from 2018

These posts are machine-translated.
Currently, only posts are displayed, which contain the tag »sysoperation-framework« Filter entfernen
Currently, only posts from »2018« are displayed

SysOperation framework: Pass selected records from a temporary table

In the following scenario, all records of a temporary table are to be passed to a SysOperation construct.

For that we need:

  • In the DataContract, a accessor method (parm-method) that takes a container
  • In the controller, a logic that iterates the records of a calling data source and packs it into a container, and passes it to the service using the above method
  • In the service class we need code, which unpacks and processed the transferred container

 

Controller

class TutorialSysOperationController extends SysOperationServiceController
{
}

 
 
 

SysOperation-Framework: Refresh calling form/formdatasource

Often, a function that has been created based on the SysOperation-framework, is called from a form via a button. Therefore there is the requirement, that the displayed data should be updated in the form after execution.

I like to use the following logic. This assumes that the call of the function is done via a button and thereby the main()-method is triggered.

This refresh is done via a sub-method and could look like this:

private void refreshCallingForm(args _args)
{
    FormRun callerFormRun;
    #Task

    if(_args && _args.caller() && _args.caller() is formRun)
    {
        callerFormRun = _args.caller();
        callerFormRun.task(#taskF5);
    }
}

The call of this method takes place in the mentioned main():

public static void main(Args _args)
{
    TutorialSysOperationController controller;
    SysOperationStartResult sysOperationStartResult;

    controller = new TutorialSysOperationController();
    controller.parmArgs(_args);
    controller.parmExecutionMode(
        SysOperationExecutionMode::Synchronous);

    sysOperationStartResult =
    controller.startOperation();

    controller.refreshCallingForm(_args);
}

Variations of the refreshCallingForm()

Instead of the task()-method of the form, one could also call some methods of the form data source.

Use of ExecuteQuery()

If you use the executeQuery() of the respective FomDataSource, any filters and the data set focus will be lost.

private void refreshCallingForm(args _args)
{
    FormDataSource fds;
    
    if(_args && 
       _args.record() && 
       _args.record().isFormDataSource())
    {
        fds = _args.record().dataSource();
        fds.executeQuery();
    }
}

Use of ReSearch()

private void refreshCallingForm(args _args)
{
    FormDataSource fds;
    
    if(_args && 
       _args.record() && 
       _args.record().isFormDataSource())
    {
        fds = _args.record().dataSource();
        fds.research(true);
    }
}

Use of ReRead()

A reRead() would be conceivable, but in this case only the active record would be updated.

private void refreshCallingForm(args _args)
{
    if(_args && 
       _args.record() && 
       _args.record().isFormDataSource())
    {
        _args.record().reread();
    }
}

 
 
 

 

 
 
 
Posts of the actual month
April 2018
MoTuWeThFrSaSu
 1
2345678
9101112131415
16171819202122
23242526272829
30 
 
© 2006-2025 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.