Friday, 8 February 2019

CLICKED METHOD EVENT HANDLER IN D365 CODE FormControlEventType::Clicked

CLICKED METHOD IN D365 ENVENT HANDLER CODE

WRITE THE BELOW CODE IN NEW CLASS OR ANY OTHER CLASS.
MAKE SURE THAT YOU USE THE METHOD SIGNATURE PROPERLY.

     // <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    [FormControlEventHandler(formControlStr(SalesEditLines, OK), FormControlEventType::Clicked)]
    public static void OK_OnClicked(FormControl sender, FormControlEventArgs e)
    {
   
        FormCommandButtonControl  callerButton = sender as FormCommandButtonControl;  //Retrieves the button
        FormRun form = sender.formRun(); //Gets the running form
// you might get error if you use callerButton.formRun
        //Get the salesId that was selected in  form
        FormDataSource salesParmTable_ds = form.dataSource(formDataSourceStr(SalesEditLines, SalesParmTable)) as FormDataSource;
        SalesParmTable salesParmTable = salesParmTable_ds.cursor();

        SalesTable salesTable=salesParmTable.salesTable();

        if(salesTable.SalesStatus==SalesStatus::Invoiced)
        {
         //code

        }

    }

Thanks,
Vikas Mehta

1 comment:

AZURE INTERVIEW QUESTIONS AND ANSWERS

AZURE INTERVIEW QUESTIONS AND ANSWERES 2021 2. What is cloud computing? Explanation:  It is the use of servers on the internet to “store...