Posts

How to Override the Lookup Method in D365 X++ Form String Control

How to Override the Lookup Method in D365 X++ Form String Control Introduction In this article, we will examine scenarios where overriding the lookup method becomes essential and walk through the steps to implement this in D365. When Should You Override the Lookup Method? Although automatic lookup forms are convenient, there are specific instances when customization is necessary: No Relation Between Tables: Some tables may not have a logical relationship, making the default setup unsuitable. String Controls Not Linked to Data Sources: When using string controls for filtering above grids, standard lookups might not suffice. Dynamic Column Display: Users may need different columns in lookup forms based on the primary form. While the AutoLookup property allows some flexibility, developers can enhance this further by overriding th...

How to Filter a Form’s Data Source Using X++ in D365 F&O

Example : "In D365 F&O, filtering a form’s data source programmatically allows for dynamic and context-sensitive displays. This guide will show you how to filter a form's data source using X++." Step 1: Overview of the Code   Step 2: Example Code to Filter Data Source YourMainTable _yourMainTable; YourRelatedTable _yourRelatedTable; str recordId; // Access the data source for filtering QueryBuildDataSource qbds = YourTargetTable_ds.query().dataSourceTable(tableNum(YourTargetTable)); // Check the record passed in args and apply the filter if (element.args().record().TableId == tableNum(YourMainTable)) {        _yourMainTable = element.args().record();            if (_yourMainTable)         {   ...

How to Open a Form and Send Records as Arguments in D365 F&O

In Microsoft Dynamics 365 Finance & Operations (D365 F&O), efficient navigation and data transfer between forms are essential for user productivity. This guide explains how to open a form, send a record as an argument, and retrieve it in the opened form.   Step 1: Preparing the Caller Form Write a code snippet to open a form with parameters using args and formrun .   Args args = new Args(formStr(YoorForm) ); FormRun formRun; args.parm(YourTable); args.caller(element); formRun = classFactory.formRunClass( args); formRun.init(); formRun.run(); formRun.wait(); Step 2: Receiving the Record in the Opened Form Use the init() method to retrieve the record passed in the arguments.   public void init() {    super();      if(element.args().caller() != null && element.args().dataset()==tableName2id("YourTable"))    {        YourTable = element.args().record() as YourTable ;    }e...