web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to make the regular job, an incremental job

(0) ShareShare
ReportReport
Posted on by

Hello Everyone !

I have write a job that copies data from one table to another. both the tables are similar. both have same number of columns with similar names and data types. 

when my job runs it copies all the rows from first table to second table. But i want that every time when the job runs it only copy those rows that has been changed or added new.

Is there any default mechanism that dynamics AX provides ?

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Dear Muhammad Gulfam,

     


    If you want the job to run only on update then you can keep the following condition,

    if(!TableBuffer)

    {

    Insert

    }

    else

    {

    Update

    }

    The above algorithm, first checks whether it is new record, if it is then it will insert the new row else it means that we are updating the existing row only. If you need further clarifications please let us know.

    Thanks,

  • startax Profile Picture
    1,845 on at

    Hi Gulfam,

    Without any condition in your job its not possible to insert only new records in other table.

    Here is the sample code that first check CSV and then insert and update data in table accordingly you have to give some condition to check existing data and match with new entry in your table.

    howtoax.com/how-to-insert-and-update-data-from-csv-in-ax-2012-using-x

  • Community Member Profile Picture
    on at

    I dont get your answers.

    My job is copying rows from one table to another.

    my code is  like this:

    InventSerial inventSerial

    inventSerialCustom

    while select inventSerial

    {

    inventSerialCustom.description = inventSerial.description

    //

    //

    //

    inventSerialCustom.insert();

    }

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Hi Muhammad,

     

    You can use any of two approaches

     

    1. By placing your code in posting classes

      When a Transfer Order is posted, it goes through some classes and at end of processing of those classes you can add your code. You can also think to use post events after processing of certain methods. To get after which code, should be your customized code? You can turn on debugger to see stack trace.

       

    2. By placing your code in destination table

      When you post a transfer order, it changes/updates some values in Transfer Order header table, e.g. it may change status of Transfer Order. Etc. So, you can also write your code in update method of Transfer order header Table, based on some condition. I don’t think of any field named as posted in transfer order journal header. But if there is a field, you can write logic after super() of update() method e.g. as following

      If(this.posted == noyes::yes)

      {

      //my custom code.

      }

       

      The first approach seems more concrete. Remaining you may choose any as per your needs and scenario.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans