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, ...
Unanswered

How to use display method in event handler

(0) ShareShare
ReportReport
Posted on by 10

I have made a display method and used it in a field in salesTable form, in formcontrolgroup. The display method has some calculation and returns grossWeight type. I want to check if else in a event handler on FormControlStr and display a warning if that condtion is violated. The warning will trigger when i click on All sales order>sell ( action pane) > Generate > confirm sales order.  

I want to use that display method in event handler.

public final class SalesTable_EventHandler
{
[FormControlEventHandler(formControlStr(SalesTable, buttonUpdateConfirmation), FormControlEventType::Clicked)]
public static void buttonUpdateConfirmation_OnClicked(FormControl sender, FormControlEventArgs e)
{
    Args args = new Args();
   FormCommandButtonControl callerButton = sender as FormCommandButtonControl;
   FormRun form = callerButton.formRun();
   FormDataSource salesTable_ds = form.dataSource(formDataSourceStr(SalesTable,SalesTable)) as formDataSource;

  SalesTable salesTable = salesTable_ds.cursor();
  CustTable custTable = CustTable::find(salesTable.CustAccount);

    if( SalesTable::totalWeight(salesTable) < custTable.MinWeight)
    {
       warning("Total Gross Weight should be more than Minum weight");
    }

}

}

I have the same question (0)
  • GirishS Profile Picture
    27,843 Moderator on at

    Hi Lucifer,

    Display method you have written is in table or form level?

    Try calling like below.

    salesTable.displayMethodName();

    Just type in the method name if Intelli sense didn't show.

    Thanks,

    Girish S.

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 617

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 298 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans