Skip to main content
Answer

disable a field base on another field

  • November 3, 2025
  • 3 replies
  • 84 views

Forum|alt.badge.img

I am trying to disable the quantity field on a sales order whenever there is a linked production order. To be honest, im not even entirely sure what extension is adding this field to the soline. i dont see it on soline, or SOLineExt. I did find it on SOLineMFGOnly, but that seems to be just a projection. i tried adding the below code line to the quantity field and it does make the field readonly when there is a production order, but if i unlink the production order or delete the production order the quantity field is still disabled. i looked at the below post but when i try to use SOLineMFGOnly in the get extension, it doesnt recognize it.

 

[PXUIEnabled(typeof(Where<SOLineMfgOnly.aMProdOrdID, IsNull>))]

 

 

Best answer by aleksandrsechin

@justen0351 , the field you’re looking for is defined in the SOLineExt DAC extension, but under the PX.Objects.AM.CacheExtensions namespace. That’s why you need to adjust your PXUIEnabled attribute as follows:

[PXUIEnabled(typeof(Where<PX.Objects.AM.CacheExtensions.SOLineExt.aMProdOrdID, IsNull>))]

Result:
 

 

3 replies

Forum|alt.badge.img+1

Hi ​@justen0351 

I don't quite understand your condition used to set the SOLine.orderQty field to read-only or not. But in general, this can be implemented as follows:

 

public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
protected virtual void _(Events.RowSelected<SOLine> e, PXRowSelected baseHandler)
{
baseHandler?.Invoke(e.Cache, e.Args);
if (e.Row is not SOLine row) return;

// Custom logic to execute when a SOLine row is selected
bool isReadOnly = //your expression returning true or false;
PXUIFieldAttribute.SetReadOnly<SOLine.orderQty>(e.Cache, e.Row, isReadOnly);
}
}

 


Forum|alt.badge.img+3

@justen0351 , the field you’re looking for is defined in the SOLineExt DAC extension, but under the PX.Objects.AM.CacheExtensions namespace. That’s why you need to adjust your PXUIEnabled attribute as follows:

[PXUIEnabled(typeof(Where<PX.Objects.AM.CacheExtensions.SOLineExt.aMProdOrdID, IsNull>))]

Result:
 

 


Forum|alt.badge.img
  • Author
  • Varsity III
  • November 4, 2025

@aleksandrsechin That worked like a charm. Thank you! I was a little confused on where that field was actually being added from.