Wednesday 7 November 2012

Create Pull jobs for newly created Tables in AX retail 2012


How To Create Pull  jobs for newly created Tables in AX retail 2012.

For creating Pull  jobs for newely created tables, we need to follow the following steps :

1 . Create a new table  as below :
 2.Add below fields in table other than your normal fields :

RetailTerminalId
RetailStoreId
RetailStatementId
RetailStaffId
ReplicationCounter

3.Add below two methods in your table :



  public RetailReplicationCounter maxReplicationCounterFromOrigin(RetailConnDistributionLocationId _locationId)
{
    RetailPosBatchTable  posBatchTable;
    RetailTerminalTable terminalTable;

    if (_locationId)
    {
        if (RetailStoreTable::find(_locationId))
        {
            select maxof(ReplicationCounter) from posBatchTable
            where posBatchTable.StoreId == _locationId;
        }
        else
        {
            terminalTable = RetailTerminalTable::find(_locationId);
            if (terminalTable)
            {
                select maxof(ReplicationCounter) from posBatchTable
                where posBatchTable.TerminalId == terminalTable.TerminalId;
            }
        }
    }

    return posBatchTable.ReplicationCounter;
}



public void setMaxReplicationCounter(RetailConnDistributionLocationId _locationId, RetailReplicationCounter _counter)
{
    RetailPosBatchTable  posBatchTable;
    RetailTerminalTable terminalTable;

    if (_locationId)
    {
        if (RetailStoreTable::find(_locationId))
        {
            ttsbegin;

            while select forupdate posBatchTable
            where posBatchTable.StoreId == _locationId
            && posBatchTable.ReplicationCounter >= _counter
            {
                posBatchTable.ReplicationCounter = _counter;
                posBatchTable.update();
            }

            ttscommit;
        }
        else
        {
            terminalTable = RetailTerminalTable::find(_locationId);
            if (terminalTable)
            {
                ttsbegin;

                while select forupdate posBatchTable
                where posBatchTable.TerminalId == terminalTable.TerminalId
                && posBatchTable.ReplicationCounter >= _counter
                {
                    posBatchTable.ReplicationCounter = _counter;
                    posBatchTable.update();
                }

                ttscommit;
            }
        }
    }
}



Replace the RetailPosBatchTable   with your table name.

4. Go to Retail ->Setup ->Retail Scheduler -> Distribution Location :
Select your distribution Location and click on Location table , select the table for which you want to pull data,click on Location fields , now you can add fields either Manually or you can use function button provided.
[Make sure to select only those fields which are available in corresponding AX table,else AX will throw error , filed in not available in table]
5. Now go to Retail ->Setup ->Retail Scheduler ->Scheduler subjob
Create a new subjob :

And set the important fields as below :

6.Click on Create TempDBStaging table , which will make a temporary table TableX .
TableX is being used by AX to hold staging data.
7. Now either you can create a new P-job or you can add this sub job in existing P-job.

Run the P-job and data will be pulled to AX from Store
[Off-course you should have retail settings in Place :) ]









3 comments:

  1. hello, the Job is not working proberly ... it coping successfully .. then when change data and run again ... it does not work again
    !!!

    please can u give me any hint for the solution

    ReplyDelete
  2. Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks shedstore promo code

    ReplyDelete