In my FieldDefaulting event I have the below code
var row = (PMProject)e.Row;
decimal? dec = 0;
foreach (atcProjectLinesTable tb in ProjectLines.Select(this))
{
dec += tb.UnPrice;
}
throw new PXException("Total is "+dec);
e.NewValue = dec;
Im getting an unreachable code warning in Visual Studio and when I publish my project the fields value is zero.
Visual Studio reports about unreachable code due to PXException thrown in the middle of your FieldDefaulting event handler:
To profile intermediate values, you might take a look at the PXTrace class. The sample below shows how to write in Acumatica Trace value generated value for Sales Order Description: