·
2 min read

AXRETAIL: How to control the Action flow

Applies to AX 2012 R2 

Description:

The purpose of this article is to provide an example, how to control the data flow concerning (preaction/action).

Retailers might have to add new catalogs, Changing prices and barcodes during opening hours. If the number of changes are huge, the processing time increases and

the locking behaviour on the store database is affected.

 

 

1. Change the code, so processed always is 2 when the data is changed/added by table methods

\Classes\RetailConnActionManagement\insertAction

preactionTable.action = _type;
preactionTable.preactionDate = systemdateget();
preactionTable.preactionTime = timenow();
preactionTable.linkDown = _linkDown;
preactionTable.userId = curuserid();
preactionTable.processed = 2;

//Default: PreactionTable.processed = NoYES::No;

2. Change the default value of Processed to 2, then data inserted from a Insert_recordset will also get the value 2 in the processed field.

Code path example

Class/RetailAssortmentSchedulerTask/deltaSync

method line 106 

            insert_recordset preactions (action, linkDown, locationFilter, preactionDate, preactionTime, RefRecId, RefTableId)
                select
                    action, linkDown,
                    filter, preactionDate,
                    preactionTime, RecId, assortmentTableId
                from explodedInner
                where
                    explodedInner.createdTransactionId == currentTransId &&
                    explodedInner.OMOperatingUnitId == omOperatingUnitRefRecId &&
                    explodedInner.AssortmentRecId == assortmentRefRecId;

 

 

3. Import the two SQL agent jobs attached. (the owner id is contoso\Administrator must be changed)

The two jobs are releasing the data in two steps

  • Release Preactions non A 1040 tables

            – All preactions that are not in a table list will be released every minute.

 

  • Release Preactions A 1040 tables

           – All preactions will be released in batch of 10000 every 15 minutes

 

4. The create action can utilize batch worker threads

 If the Create actions periodic job is run in batch processing mode, it will use the Microsoft Dynamics AX batch processing framework to scale out processing by using multi-threaded logic. For this to work, you need to update the Retail Scheduler Number of documents in the batch task parameter to a larger number. For example, the number must be in the thousands instead of 0 (zero).

Hotfix needed

Create Actions job performs daily cleanup during every batch task which slows the job down considerably

 KB Article Number (s) : 2995408  

 

 

 

 5. Add the CREATE ACTIONS to batch every 5-15 minutes

 

 

6. It is possible to control the A job flow when sending the data out of AX.

In the case a table has very high number of changes, it can cause locking issue on the store database.

By setting the number of Action Counter Interval, it will look only take the specified number of lines in the RetailConnActionTable

 

Responsible class:

\Classes\RetailConnReplicationAJob\processActions

 

    // There is no logging for this method as this is executed in a very tight loop. It affects the run time.

    [sourceCounter, upperCounter] = this.replicationCounter(_fromTableId, _schedulerSubjobTable.ActionCounterInterval);

    if (sourceCounter >= upperCounter)

    {

        return 0;

    }

 

    currentDeletedRecordCount = 0;

    currentReadRecordCount = 0;

 

 

 

Author: Kim Truelsen

Date…: 7/10-2014

 

SQLAGENTJOBS.zip