web
You’re offline. This is a read only version of the page.
close
Skip to main content
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,825 Moderator on at
    RE: How to use display method in event handler

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 756 Super User 2025 Season 2

#2
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 678

#3
Martin Dráb Profile Picture

Martin Dráb 526 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans