Show limited records in a grid on a form X++

Purpose:

The purpose of this document is to demonstrate how to show limited  records in a grid on a form  X++ based on a business logic.

Ex: i want to show only records which are matching my logic in vendor group form

Product:

Dynamics 365 for Finance and Operations.

Development approach:

Customization through CODE, we need to  show limited records in a grid on a form on executequery method to update values

Development:

Created a execute query method (form data source)and applied ranges" in my case i want to show only vend group match with "INT"



once executequery method is completed, calling our code in for data source "INIT" method.


Code:


[ExtensionOf(formdatasourcestr(VendGroup, VendGroup))]
internal final class vendgroup_Extension
{
    /// <summary>
    ///
    /// </summary>
    public void executeQuery()
    {
        next    executeQuery();
        QueryBuildDataSource    qbd;
        qbd = this.query().dataSourceTable(tableNum(VendGroup));
        qbd.clearRanges();
        qbd.addRange(fieldNum(VendGroup, VendGroup)).value("INT");
    }

    public void init()
    {
        next init();
        this.executeQuery();
    }
}

Build and test result



Comments