Hello,
Can someone tell me, how to call the clicked event of the command button through the code.
I would like perform some operation within the code so that user manually doesnt have to click the button.
How can i achieve through envent handler.
Thanks
Hi Jeff, I think Auto Declaration of command button cannot be changed in form extension for standard form. You can refer below code to access the command button via event handler. If you are using custom form then just change AutoDeclaration property of command button to Yes and access it directly in your code by control name.
[FormDataSourceEventHandler(formDataSourceStr(MyDialogForm, SalesLine), FormDataSourceEventType::Activated)] public static void SalesLine_OnActivated(FormDataSource sender, FormDataSourceEventArgs e) { FormCommandButtonControl okButton = sender.formRun().design().controlName(identifierStr(OK)); okButton.clicked(); }
Adding to Girish using formrun you can get the control and call the clicked method if control has auto declaration no.
You can set the Auto declaration property of the command button control to Yes and then call ControlName.clicked().
Thanks,
Girish S.
I want to call click event of the button in lets say some form datasource method.
Hi Jeff,
Can you please elaborate on your question.
Where you want to call the code on the clicked method.
Thanks,
Girish S.
André Arnaud de Cal...
292,074
Super User 2025 Season 1
Martin Dráb
230,900
Most Valuable Professional
nmaenpaa
101,156