How to use Update_RecordSet in AX 2012

Description:-

Update_RecordSet () is Nothing but if you want to update Multiple record in Dynamically in AX Table then you can update like this. May some condition you need to update multiple record based on condition in any method then you can use Update_RecordSet in Method for updating multiple records in table. Int this example we will create job and explain how to update multiple record in table.

Create Job from AOT

  • In the AOT, click Job.
  • Right-click the Job node, and then select New Job.
static void Update_RecordsetExmple(Args _args)
{
    A_Student _Student,_Student1;
    // str ID = 'CT_025';
    //info("BEFORE UPDATE");
    /*while select _Student
    where _Student.Student_ID == 'CT_025'
    {
        info(strfmt("Student-ID %1 has Student-Name %2 ", _Student.Student_ID,_Student.Student_Name));
    }*/       
    update_recordset _Student
    setting Student_Name = 'Janak'//_Student.Student_Name + 'Manshi'
    where _Student.Student_ID == 'CT_025';
   
    //info("AFTER UPDATE");
    while select _Student
    where _Student.Student_ID == 'CT_025'
    {
        info(strfmt(" From This Student-ID %1 Name Replace With-%2 ", _Student.Student_ID,_Student.Student_Name));
    }  
}

Now first see how many data are in A_Student table.

Now run your Job then Info log will Open for Information.
Now Open your table and see Data.

Related Posts

Previous
Next Post »