Solved

Disable field in Sales Orders SO301000 Screen

  • 27 April 2023
  • 2 replies
  • 89 views

Userlevel 3
Badge

Hi Expert.

I try disale field So Notes depends on the condition of the shipment  in below:

I try set break point at:

PXUIFieldAttribute.SetEnabled(cache, row, true);

                        PXUIFieldAttribute.SetEnabled<SOOrderExt.usrSoNote>(cache, row, true);

 

break point ok, program touch here.

 protected void SOOrder_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)

        {

            InvokeBaseHandler?.Invoke(cache, e);

            var row = (SOOrder)e.Row;

            if (row != null && row.OrderNbr != null)

            {

                Base.Document.Cache.AllowUpdate = true;

                Base.Transactions.Cache.AllowUpdate = true;

                SOOrderShipment ship = PXSelect<SOOrderShipment, Where<SOOrderShipment.orderNbr, Equal<Required<SOOrderShipment.orderNbr>>>>.Select(Base, row.OrderNbr.Trim());

                if (ship != null && ship.ShipmentNbr != null)

                {

                    SOShipment shipment = PXSelect<SOShipment, Where<SOShipment.shipmentNbr, Equal<Required<SOShipment.shipmentNbr>>>>.Select(Base, ship.ShipmentNbr.Trim());

                    if (shipment != null && shipment.Status != null && !ConstantsSO.SHIP_STATUS_OPEN.Equals(shipment.Status))

                    {

                        PXUIFieldAttribute.SetEnabled(cache, row, false);

                        PXUIFieldAttribute.SetEnabled<SOOrderExt.usrSoNote>(cache, row, false);

                    }

                    else

                    {

                        PXUIFieldAttribute.SetEnabled(cache, row, true);

                        PXUIFieldAttribute.SetEnabled<SOOrderExt.usrSoNote>(cache, row, true);

                    }

                }

                else

                {

                    PXUIFieldAttribute.SetEnabled(cache, row, true);

                    PXUIFieldAttribute.SetEnabled<SOOrderExt.usrSoNote>(cache, row, true);

                }

            }

        }

 

but this field still enable

 

Can you help me? Thank you so much.

icon

Best answer by Vignesh Ponnusamy 27 April 2023, 16:09

View original

2 replies

Userlevel 3
Badge

Dear @Vignesh Ponnusamy and All. I enable aboth by code and edit workflow, it work ok. Thank everyone so much. Have a good day!

Userlevel 7
Badge +4

@thanhaim,

To enable the field apart from the code you need to enable in the workflow extension as well. From your note, I assume you want to enable the custom field when the document is in Shipping status and based on the status of the Shipment line. 

As you already have in the RowSelected event you can do the logic check there, enable in the code. In addition to it, you just enabled the field in the TR workflow extension(as the document type is TR here). Below is the screenshot of the options for your reference,

 

 

 

As an example, I have added Description field and made sure it is not Disabled. Similarly, you can add the custom field in the Shipping state and uncheck the Disabled checkbox. Hope that helps.! 

Thanks,

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved