New Display Method in Form Data Source and Display PO Information in Sales Order Detail Form. AX7 (Dynamics 365 for Operations)

Hi

How to add new display method in Form Datasource. (Instead of adding new DataSource in Form i.e. in my case i have avoided adding PurchTable DataSource in form but added two display methods to view data in Sales order Inquiry form under SalesTable DataSource)

Step 1:
Right Click Form Data Source Methods and select "New Method"



Step 2:

This automatically open Class code window and i have added PO Number and Supplier Number for my form.




Step 3: I have added new 2 string controls in form grid and assigned newly added display method from Form Data Sources as below.





OR by below

       SalesLine salesLine;
       PurchTable purchTable;
        purchTable = PurchTable::find(salesLine.InventRefId);
        this.SupplierName=purchTable.vendorName();


Sample Codes

 [DataSource]
    class PriceDiscTableExt
    {
        /// <summary>
        ///
        /// </summary>
        PUBLIC  display Purchid  displayPONumber(PriceDiscTableExt _PriceDiscTableExt)
        {
            PriceDiscTableExt_DS.observe();
            PurchLine _purchline ;
            select firstonly  PurchId  from _purchline where _purchline.SubPriceDiscTableRefRecId ==_PriceDiscTableExt.RecId ;
            return _purchline.PurchId;
        }

        PUBLIC  display ItemId  displayItemId(_PriceDiscTableExt _PriceDiscTableExt)
        {
            PriceDiscTableExt_DS.observe();
            PurchLine _purchline ;
            select firstonly  ItemId  from _purchline where _purchline._SubPriceDiscTableRefRecId ==_PriceDiscTableExt.RecId ;
            return _purchline.ItemId;
        }

        PUBLIC  display LineNumber  displayLineNumber(_PriceDiscTableExt _PriceDiscTableExt)
        {
            PriceDiscTableExt_DS.observe();
            PurchLine _purchline ;
            select firstonly  LineNumber  from _purchline where _purchline.SubPriceDiscTableRefRecId ==_PriceDiscTableExt.RecId ;
            return _purchline.LineNumber;
        }

    }


Comments

Post a Comment