Search code examples
acumatica

Check Attribute for isEnabled


Could me please if it is possible to check the attribute for what state it is in now? For example:

PXUIFieldAttribute.SetEnabled<MyQuery.value>(linkCache, linkInfQuery, false);

it doesn't work, but in order to make it clearer, i want something like this

if(PXUIFieldAttribute.SetEnabled<MyQuery.value> == false ) 
{ .... }

Solution

  • You could try to use PXFieldState to read the Enabled property from your field. I think this is possible in the FieldSelecting event like this:

    protected void _(Events.FieldSelecting<RSSVWorkOrderItem, RSSVWorkOrderItem.myDacField> e)
            {
                PXFieldState state = (PXFieldState) e.ReturnState;
                if (state.Enabled == true)
                {
                    // Do stuff
                }
            }
    

    I also recommend you take a look into the Acumatica Framework Development guide and search for the chapter Internal and External Presentation of Values