Customization Code only works in Developer Mode

customization

(John Rademacher) #1

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


(Brandon Anderson) #2

Did you set the menu item to use your customization?


(John Rademacher) #3

I’m not sure if I did. I just open the form and right click to import the customization. How do I set the menu item?


(Brandon Anderson) #4

you have to go into menu maintenance, and find the form that you are working on (keep in mind it might be in multiple places and you need to set all of them if you want them all to use the same customization). Then at the bottom is a drop down to apply the customization.

If it doesn’t show up there, copy your customization and check the “all companies” check box when you save it. It doesn’t show up unless you check that box. (or do something else with the company stuff but 99% of people just use all companies)

note: I’m on 10.1 but I’m assuming this part hasn’t changed in 10.2


(John Rademacher) #5

Thank you! It’s working now.


(Tom Hulbert) #6

Don’t forget to mark the post as solved :slight_smile: