web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

FormControlEventHandler - How to call the form method (PurchEditLines)?

(1) ShareShare
ReportReport
Posted on by 845
Hello,
 
Using FormControlEventHandler, do I need to call the form method. I need to call the PurchEditLines.purchFormLetter(). How can I do this?
 
[FormControlEventHandler(formControlStr(PurchEditLines, OK), FormControlEventType::Clicked)]
    public static void OK_OnClicked(FormControl sender, FormControlEventArgs e)
    {
        FormRun formRun = sender.formRun();
        FormDataSource purchparmtable_ds = sender.formRun().dataSource(/PurchParmTable/);
        purchparmtable purchparmtable = purchparmtable_ds.cursor();
   
        // PurchFormLetter purchFormLetter =
 
        // TODO
     }
I have the same question (0)
  • Suggested answer
    Layan Jwei Profile Picture
    8,165 Super User 2026 Season 1 on at
    Hi Shooowtek,
     
    Is this method in form level?
    If yes, then you already defined formRun which is the form for your control.
    So would formRum.purchFormLetter() work?
     
    Thanks,
    Layan Jweihan
  • Verified answer
    Martin Dráb Profile Picture
    239,645 Most Valuable Professional on at
    Trying to put business logic to clicked() is usually a bad approach and it's indeed the case here.
     
    The OK button is a command button. It has no code in clicked(); the F&O kernel executes the command, which is closing the form. Then kernel executes a few form methods like canClose() and closeOK() (you can see existing business logic of PurchEditLines form there). Therefore you should create an extension of PurchEditLines form and extend a method like closeOK() with CoC. And there you can simply refer to purchFormLetter by name.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 722

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 605 Super User 2026 Season 1

#3
Subra Profile Picture

Subra 547

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans