Skip to main content

Notifications

Announcements

No record found.

How to get the FormControl (form fields and buttons etc.) value in the event handler. #Dynamics #D365 #ax

Here I'm going to show how can we get the value of any FormControl in any event handler. It's my OnClicking event of the OK button and I'm getting the Gross weight value here. It is a string FormControl that's why I'm using FormStringControl here. 

JmgProductionFloorExecutionReportProgress is the form name and ComboboxGrossWeight is the control name here.

[FormControlEventHandler(formControlStr(JmgProductionFloorExecutionReportProgress, OKButton), FormControlEventType::Clicking)]

public static void OKButton_OnClicking(FormControl sender, FormControlEventArgs e)

{

FormRun             formRun         = sender.formRun();

FormStringControl grossWeight = formRun.design().controlName(formControlStr(JmgProductionFloorExecutionReportProgress, ComboboxGrossWeight)) as FormStringControl;

}

//Here some another example of getting a Button and real value.

FormCommandButtonControl refresh = formRun.design().controlName(formControlStr(SalesTable, Refresh));

FormRealControl totalWeight = sender.formRun().design().controlName(formControlStr(SalesTable, TotalWeight));

Comments

*This post is locked for comments