AX – D365FO – Update a field value of a table with the value of a joined table in update_recordset

This example shows that the update_recordset statement supports the joining of several tables. Data from the joined tables can be used to assign values to fields in the table that is being updated.

static void Join22aJob(Args _args)
    {
        TableEmployee tabEmpl;
        TableDepartment tabDept;
        TableProject tabProj;
        ;
        update_recordset tabEmpl
        setting
            currentStatusDescription = tabDept.DeptName
                + ", " + tabProj.ProjName
        join tabDept
            where tabDept .DeptId == tabEmpl.DeptId
        join tabProj
            where tabProj .ProjId == tabEmpl.ProjId;
    
        info(strFmt("Number of records updated is %1."
            ,tabEmpl .rowCount()));
    }

Leave a comment