Skip to main content

Notifications

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
    GirishS 27,821 Super User 2024 Season 1 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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,971 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,846 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans