I’m trying to conditionally hide a column on the Labor screen (AM301000) and I can’t for the life of me figure out the code.
protected void AMBatch_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
if(InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var row = (AMBatch)e.Row;
PXUIFieldAttribute.SetVisible<Objects.AM.AMMTran.laborRate>(Base.transactions.Cache, row, false);
}
However, that generates an error:
The entry form (ID: AM301000, title: Labor) cannot be automated. Unable to cast object of type 'PX.Objects.AM.AMBatch' to type 'PX.Objects.AM.AMMTran'.
This:
PXUIFieldAttribute.SetVisible<Objects.AM.AMMTran.laborRate>(cache, row, false);
Does nothing - the field remains visible. I don’t think there is any workflow attached to the form.
I’ve tried to access the transactions view but it doesn’t seem to be part of Base. I think that this form is pulling transactions through another layer of extensions.
What am I missing?