I am trying to use the Form Event Wizard to set a database field to the product of some UD fields upon entering a value in the UD fields on the Opportunity/Quote Entry form. The code compiles with no errors or warnings, and works as intended when testing in developer mode, but the code doesn’t trigger after I import it. Here’s the Form Event Handler Code:
private void QuoteMtl_AfterFieldChange(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 "A1QtyBox_c":
if(Convert.ToString(args.Row["IUM"])=="IN")
{
args.Row["QtyPer"]=Convert.ToDecimal(args.Row["A1QtyBox_c"])*Convert.ToDecimal(args.Row["A1LengthBox_c"]);
}
else if(Convert.ToString(args.Row["IUM"])=="EA")
{
args.Row["QtyPer"]=Convert.ToDecimal(args.Row["A1QtyBox_c"]);
}
else if(Convert.ToString(args.Row["IUM"])=="SQIN")
{
args.Row["QtyPer"]=Convert.ToDecimal(args.Row["A1QtyBox_c"])*Convert.ToDecimal(args.Row["A1LengthBox_c"])*Convert.ToDecimal(args.Row["A1Width_c"]);
}
break;
case "A1LengthBox_c":
if(Convert.ToString(args.Row["IUM"])=="IN")
{
args.Row["QtyPer"]=Convert.ToDecimal(args.Row["A1QtyBox_c"])*Convert.ToDecimal(args.Row["A1LengthBox_c"]);
}
else if(Convert.ToString(args.Row["IUM"])=="EA")
{
args.Row["QtyPer"]=Convert.ToDecimal(args.Row["A1QtyBox_c"]);
}
else if(Convert.ToString(args.Row["IUM"])=="SQIN")
{
args.Row["QtyPer"]=Convert.ToDecimal(args.Row["A1QtyBox_c"])*Convert.ToDecimal(args.Row["A1LengthBox_c"])*Convert.ToDecimal(args.Row["A1Width_c"]);
}
break;
case "A1Width_c":
if(Convert.ToString(args.Row["IUM"])=="IN")
{
args.Row["QtyPer"]=Convert.ToDecimal(args.Row["A1QtyBox_c"])*Convert.ToDecimal(args.Row["A1LengthBox_c"]);
}
else if(Convert.ToString(args.Row["IUM"])=="EA")
{
args.Row["QtyPer"]=Convert.ToDecimal(args.Row["A1QtyBox_c"]);
}
else if(Convert.ToString(args.Row["IUM"])=="SQIN")
{
args.Row["QtyPer"]=Convert.ToDecimal(args.Row["A1QtyBox_c"])*Convert.ToDecimal(args.Row["A1LengthBox_c"])*Convert.ToDecimal(args.Row["A1Width_c"]);
}
break;
case "A1TotalMTLPrice_c":
if(Convert.ToString(args.Row["IUM"])=="EA")
{
args.Row["EstUnitCost"]=Convert.ToDecimal(args.Row["A1TotalMTLPrice_c"])/Convert.ToDecimal(args.Row["QtyPer"]);
}
break;
}
}
Anyone have a clue on what’s going on? I’m incredibly new to C# so I’m learning all this on the fly.
Also I’m working in Epicor 10.2.100.8