Dynamics AX Blog - Page 5

These posts are machine-translated.

Create waves for one or multiple deliveries

The following snippet shows how to build waves and work for one ore more delivery through code. This will usually happen if you use the "Release to warehouse" function.

WHSWaveTable::buildWaveFromShipments(['USMF-000006','USMF-000007']);

 
 

Updating an AX 2012 R3 VPC

Recently, I wanted to update my locally installed AX 2012 R3 CU8 to a newer version. This requires the following:

  • Access to Lifecycle Services (LCS)
  • At least a couple of hours

Below are some screenshots and comments I made during the update.

Log in to LCS and download the installer

Screenshot


 
 

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();
    }
}

 
 

Release load to warehouse

The following code snippet executes the "Release to warehouse" function of a load, but without generating the waves/work.

static void Job1(Args _args)
{
    ttsBegin;
    WHSLoadPostEngine::post(whsLoadTable::find('USMF-000004', true));
    ttsCommit;
}

 
 

Process wave through code

With the following code, you can process a wave through code. This is normally done when calling the function "Release to warehouse", depending on the WHS parameters.

WHSPostEngine::post(WaveTable::find('USMF-000000003'));

 


 
 

Add sales order line to existing load through code

In this post I would like to show how you can add all the lines of an sales order or even a selection of sales order lines by code to an existing load.


 
 

Call SSRS-Report through code

A common requirement is that a report / report should be printed automatically at a certain point in time.

It is usually important to be able to give certain parameters to the report to be printed, and depending on how the report is structured on the development side this can be more or less complicated.

The following code calls a relatively simple Dataprovider-based report:

TutorialMyReportDataContract dataContract;
SrsReportDataContract srsReportDataContract;

controller = new SrsReportRunController();
controller.parmReportName(ssrsReportStr(TutorialMyReport, MyDesign)); 
controller.parmShowDialog(false);    
controller.parmLoadFromSysLastValue(false);  

srsReportDataContract =
controller.parmReportContract();

dataContract = srsReportDataContract.parmRdpContract();

dataContract.parmSalesId("S1000"); 

The next example calls the standard report Transactions (Customer Accounts > Reports > Transactions > Customer). The special feature of this report is that it uses a query within the data provider. To access these was the challenge:


 
 
Pages « 1 2 3 4 5 6 7 8 ... 24 » 

 

 
 
 
Posts of the actual month
April 2024
MoTuWeThFrSaSu
1234567
891011121314
15161718192021
22232425262728
2930 
 
© 2006-2024 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.