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");
    }

}

}

  • GirishS Profile Picture
    27,845 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 536 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 363 Super User 2026 Season 2

#3
CU-1234529-002 Profile Picture

CU-1234529-002 188

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans