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.
Valuable post useful for everyone.Keep on sharing.
ReplyDeleteMicrosoft Dynamics AX Training
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
ReplyDeleteWonderful 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
ReplyDeletePositive 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