Skip to main content

X++ code to show record count during set based update operation in D365FO

Hi,
 
In this post we view the code to know the record count after set based update operation.
For demo purpose, created a runnable class "CG_UpdateRecordSetRecordCount" and used the below code to update the field "classification group" of customers based on customer group.
 
Code:
class CG_UpdateRecordSetRecordCount
{        
    /// <summary>
    /// Runs the class with the specified arguments.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    public static void main(Args _args)
    {
        CustTable custTable;

        ttsbegin;
        update_recordset custTable
            setting CustClassificationId = "01"
            where custTable.CustGroup  == "30";
        ttscommit;

        Info(strfmt("%1 records are updated", custTable.RowCount()));
		        
    }

}
 
Output: Build the solution and executed the class to view the output.
Regards,
Chaitanya Golla

Comments

*This post is locked for comments