Solved

Read only field in grid by Field update event

  • 17 October 2023
  • 2 replies
  • 110 views

Userlevel 3
Badge

Hi Team,

Need to know how to enable or disable specific field based on the another field value. Can someone help me? Here is my code

protected void _(Events.FieldUpdated<HMRCVendorRegisterDetail, HMRCVendorRegisterDetail.verifiedTypeID> e)
        {
            HMRCVendorRegisterDetail row = e.Row;

            if (row == null) return;

            if (e.OldValue != e.NewValue)
            {
                if (row.VerifiedTypeID.Equals("M"))
                {
                    row.VerificationNote = "Manual Verified By " + PXAccess.GetUserName() + " On :" + DateTime.Now.ToString();
                     //row.VerifiedDate  Need to Enable/Disable this field
                }
                              
            }
        }

icon

Best answer by Yuriy Zaletskyy 17 October 2023, 19:26

View original

2 replies

Userlevel 7
Badge +4

you could try something like 

PXUIFieldAttribute.SetEnabled<...>

 

reference: How to disable a custom field in a grid | Community (acumatica.com)

https://help.acumatica.com/(W(189))/Help?ScreenId=ShowWiki&pageid=79a99243-7926-f570-87ed-536a04ccfe32

Userlevel 5
Badge +3

You need to use SetEnabled method of PXUIFieldAttribute. Also make sure, that you use RowSelected event of main DAC class, otherwise, may be ommited from execution ( I don’t know why ). Below goes fragment of Acumatica source code:

 

		protected virtual void Vendor_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
Vendor vendor = (Vendor) e.Row;
T5018VendorExt extension = PXCache<BAccount>.GetExtension<T5018VendorExt>(vendor);
if (vendor.Vendor1099 == true)
{
PXUIFieldAttribute.SetEnabled<T5018VendorExt.vendorT5018>(cache, null, isEnabled: false);
PXUIFieldAttribute.SetEnabled<Vendor.box1099>(cache, null, isEnabled: true);
}

 

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