Tuesday 26 November 2019

update method d365 eventhandlertable DataEventType::Updating D365 Code

Below is the event handler code to write at the table level for Updating any value.

Eventhandler code for updating a value at the table level .

[DataEventHandler(tablestr(FMRentalCharge),DataEventType::Updating),
     SuppressBPWarningAttribute('BPParameterNotUsed', 'This is not production code')]
    public static void FMRentalChargeUpdatingEvent(Common c, DataEventArgs e)
    {
        FMRentalCharge rentalCharge = c;
        FEDiscountEngine discountEngine;

        if (rentalCharge.orig().PerUnitAmount != rentalCharge.PerUnitAmount ||
            rentalCharge.orig().Quantity != rentalCharge.Quantity)
        {
            discountEngine = FMTotalsEngineBase::GetInstance() as FEDiscountEngine;
            if (discountEngine)
            {
                discountEngine.calculateChargeRate(rentalCharge);
            }
        }
    }

FMRentalChargeUpdatingEvent-> you can write any name .
SuppressBPWarningAttribute - > is optional ( it is for not using the e parameter of the dataeventargs.

4 comments:

  1. Valuable post useful for everyone.Keep on sharing.
    Microsoft Dynamics AX Training

    ReplyDelete
  2. When your website or blog goes live for the first time, it is exciting. That is until you realize no one but you and your. Microsoft Dynamics 365 Sales Credit Card Processing

    ReplyDelete
  3. Wonderful Post. This is a very helpful post. These are the useful tips for. I would like to share with my friends. To know more about me visit here Dynamics 365 Marketing Functional Consultant Associate

    ReplyDelete
  4. Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. Microsoft Dynamics 365 Business Central Credit Card Processing

    ReplyDelete

AZURE INTERVIEW QUESTIONS AND ANSWERS

AZURE INTERVIEW QUESTIONS AND ANSWERES 2021 2. What is cloud computing? Explanation:  It is the use of servers on the internet to “store...