Sunday, 20 February 2022

Filter DataSource in form D365 FO

[Form]

public class DDD_ViewContracts extends FormRun

{

    [DataSource]

    class DDD_ViewContractsView

    {

        public void init()

        {

            if(element.args().record())

            {

                SalesTable   salesTable = element.args().record();

                super();

                Query q = DDD_ViewContractsView_ds.query();

                QueryBuildDataSource rootDS = q.dataSourceTable(tablenum(DDD_ViewContractsView));

                rootDS.clearRanges();

                QueryBuildRange range = rootDS.addRange(fieldnum(DDD_ViewContractsView, CustAccount));

                range.value(SysQuery::value(salesTable.CustAccount));

                range.status(RangeStatus::Locked);

                if(salesTable.InventLocationId)

                {

                    range = rootDS.addRange(fieldnum(DDD_ViewContractsView, LocationId));

                    range.value(SysQuery::value(salesTable.InventLocationId));

                    range.status(RangeStatus::Locked);

                }          

            }

        }

    }

No comments:

Post a Comment

DefaultDimension in d365 FO X++

 Navigate to PurchTable methods you can find with DefaultDimension this.DefaultDimension = this.mergeDimension(this.getDefaultDimension(),th...