Friday, 15 September 2017

How to customize a standard form in D365


Hello readers !!!!

Today i want to explain how to customize standard form in dynamics 365.

Task

To filter purchase order form with default open order status.

  1.       Create a form extension


                PurchTable
    


 2     Go to –>> Purchtable Datasource >> Events >> Copy Event handler method



3.       Create a new menu item with the form Purchtable
4.     Create a new class  and paste the event handler and write your own logic


class DIPL_PurchTableOpenOrder
{
   
    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    [FormDataSourceEventHandler(formDataSourceStr(PurchTable, PurchTable), FormDataSourceEventType::Initialized)]
    public static void PurchTable_OnInitialized(FormDataSource sender, FormDataSourceEventArgs e)
    {
        FormRun     fromRun;
        DataSourceName  ds;
        Query           q ;    
       
        fromRun = sender.formRun();

        if(fromRun.args().menuItemName() == menuItemDisplayStr(DIPL_OpenPurchTable))
        {
            q = sender.query();
            q.dataSourceTable(tableNum(PurchTable)).addRange(fieldNum(PurchTable, PurchStatus)).value(queryValue(PurchStatus::Backorder));
        }
       
    }

}



5.  Check in the front end whether our customized form is added or not 


Output



No comments:

Post a Comment