Tuesday 26 November 2019

d365 eventhandler insert method table DataEventType::Inserting D365 Code

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

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

        discountEngine = FMTotalsEngineBase::GetInstance() as FEDiscountEngine;
        if (discountEngine)
        {
            discountEngine.calculateChargeRate(rentalCharge);
        }
    }

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

No comments:

Post a Comment

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