Hello,
We have a need to conditionally disable/enable line level fields. Simply like below:
If SOline.CWI= True, enable “Price per LB”, disable “Unit Price”
While SOline.CWI= false, Disable “Price per LB”, enable “unit price.”
Actually, this can be achieved before, by putting codes in SOline_rowselected like:
protected void SOLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
SOLine soLine = (SOLine)e.Row;
if (soLine != null)
{
SOLineExt soLineExt = PXCache<SOLine>.GetExtension<SOLineExt>(soLine);
if (soLineExt.CWI == true)
{
PXUIFieldAttribute.SetEnabled<SOLine.curyUnitPrice>(cache, soLine, false);
PXUIFieldAttribute.SetEnabled<SOLineExt.usrPricePerLB>(cache, soLine, true);
.....
}
else
{
PXUIFieldAttribute.SetEnabled<SOLine.curyUnitPrice>(cache, soLine, true);
PXUIFieldAttribute.SetEnabled<SOLineExt.usrPricePerLB>(cache, soLine, false);
....
However, this would cause performance issue, if user try to input more than 10 lines.
I tried to put the same codes in SOLine_InventoryID_FieldUpdated, it does not work as expected.
No matter CWI true or NOT, both “price per lb” and “unit price” are enabled after inventory id being input.
Best answer by darylbowman
View original