I’m trying to add a simple calculation to the Quote Entry customization layer. For some reason it’s not tripping into the custom code and I’m at a loss as to why. Probably something simple but so far I’m not seeing.
What I’m trying to do is when the price field is changed for the line item I calculate the resulting margin utilizing the costs which have been totaled and filled into a UD field through use of a BPM. The BPM works and fills the new UD field with the total of costs so that’s not a problem (verified through a BAQ).
Here’s my logic:
private void QuoteDtl_BeforeFieldChange(object sender, DataColumnChangeEventArgs args)
{
// ** Argument Properties and Uses **
// args.Row["FieldName"]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
switch (args.Column.ColumnName)
{
case "DspExpUnitPrice":
MessageBox.Show("Changing DspExpUnitPrice for proposed value of " + args.ProposedValue);
if (Convert.ToDecimal(args.ProposedValue) != 0)
{
MessageBox.Show("non-zero value of" + Convert.ToDecimal(args.ProposedValue));
args.Row["VMPct_c"] = ((Convert.ToDecimal(args.ProposedValue) -
Convert.ToDecimal(args.Row["VMPct_c"])) /
Convert.ToDecimal(args.ProposedValue)) * 100;
}
break;
}
}
}
I initially set it up as AfterFieldChange and got nothing. I then added in the message boxes to verify that it was actually getting into the code block and saw nothing. I then changed it up to be the ExpUnitPrice field instead of DspExpUnitPrice (which is the field mapping for the field I’m changing in my test) but still no-go. For some reason the new code block isn’t getting tripped and I’m at a loss to explain why. Anyone out there who has insight and can provide guidance is a winner in my books. I’ve been throwing everything but the kitchen sink at this one for the better part of a day with nothing to show so far.