Thursday, March 15, 2018

How to read the value from Unbound(Checkbox) control in D365

/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

[FormControlEventHandler(formControlStr(VendTable, DIPL_VendorBlocking), FormControlEventType::Modified)]

public static void DIPL_VendorBlocking(FormControl sender, FormControlEventArgs e)
{
        FormCheckBoxControl  callerButton = sender as FormCheckBoxControl ;  //Retrieves the button that we're reacting to
        FormRun element = callerButton.formRun();

        if(callerButton.checked())
        {
             VendTable vendTable = sender.formRun.datasource(1).cursor(); // this will read the current record from the table.
             vendTable.Blocked   = custVendorBlocked::ALL; // updating table field.
         
        }
}

Helpfull reference :
https://shyamkannadasan.blogspot.in/2017/04/form-control-event-handler-methods-in.html
https://community.dynamics.com/ax/b/365operationswithsukrut/archive/2018/01/15/customizing-d365-with-event-handlers

No comments:

Post a Comment

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// &l...