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

Use Extension in a form control method - X++

(0) ShareShare
ReportReport
Posted on by 65

Is it possible to use an extension in BudgetCreateTransfer form control?

I tried the event handler but it didn't go through my event handler code.

My goal is to write my custom code before element.close();

pastedimage1580198945370v1.png

pastedimage1580199110451v2.png


Thanks in advance!

I have the same question (0)
  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,095 on at

    Hi Jerrold,

    Do you want to put your code between Box::Info and element.close?

    You can try to use extensions for form controls (docs.microsoft.com/.../method-wrapping-coc and put your code before next statement.

  • jerrold-verzosa Profile Picture
    65 on at

    How can I access BudgetTransactionHeader.RecId in my extension?

  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    In CoC you can access any public and protected members of the augmented class (in this case form). You access them by referring to their name.

    So, type BudgetTransactionHeader.RecId to access that field.

    However there's some glitch and you might need to assign the table buffer to a local variable first.

    Something like

    BudgetTransactionHeader budgetTransActionHeaderLocal = budgetTransactionHeader;
    // now you can access it via budgetTransActionHeaderLocal .RecId

  • jerrold-verzosa Profile Picture
    65 on at

    [ExtensionOf(formControlStr(BudgetCreateTransfer, RequestBudgetButton))]
    final class BudgetCreateTransfer_Extension
    {
    
        public void clicked()
        {
            next clicked();
            BudgetTransactionHeader budgetTransActionHeaderLocal = budgetTransactionHeader;
    
            Info(strFmt("%1", budgetTransactionHeader.RecId));
        }
    

    pastedimage1580204037633v1.png

    The qualifier 'budgetTransactionHeader' is not valid in this context. Use a variable of this type instead.

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,095 on at

    Hi Jerrold,

    Try element.budgetTransactionHeader.RecId.

  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    Try budgetTransactionHeaderLocal.RecId as I instructed :)

  • jerrold-verzosa Profile Picture
    65 on at

    Thanks for this but the element.budgetTransactionHeader.RecId worked on my case.

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 659

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 304 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans