I’ve read through a bunch of posts here and on Stack Overflow but haven’t found an answer that works. I want to extend Customer with a form on a custom tab using a set of fields from a custom table, rather than the user field approach which will add fields to the BAccount table and thus the other entities that share that definition. I created a custom table then a customization project with the DAC schema definition, extended screen AR.30.30.00 with a new tab, added a form to the tab, and then bound my view for the custom DAC to the form. Now for starters, I want to make the tab conditionally visible on customer class ID using the RowSelected event. Based on the T210 training, I assume I need to get a reference to the extension then set the tab to visible if it’s set to not visible generally. I can’t seem to get the syntax correct for the extension variable. I either get the CS0120 (Object reference required...) error or the CS0311 (Type...can’t be used as type ‘TNode’...) error no matter how I adjust the syntax. Can you tell me what the correct syntax would be to get the instance of the extension in the event handler and then how to reference the name of the custom tab? Thanks.
Table: ZZCustomerDealerExt
DAC: ZZCustomerDealerExt
View: CustomerDealerExt
using PX.Objects.AR;
using ARCustomerDealerExt;
using static PX.Objects.TX.CSTaxCalcType;
namespace PX.Objects.AR
{
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class CustomerMaintExt : PXGraphExtension<PX.Objects.AR.CustomerMaint>
{
#region Event Handlers
protected void _(Events.RowSelected<Customer> e)
{
var customer = e.Row;
if (customer == null)
return;
// var customerExt = customer.GetExtension<CustomerMaintExt>();
CustomerMaintExt customerExt = PXCache<CustomerMaint>.GetExtension<CustomerMaintExt>(customer);
bool enableFields = customerExt != null && customer.CustomerClassID == "DEALER";
// PXUIFieldAttribute.SetEnabled<CustomerMaintExt.tabname?>(e.Cache, e.Row, enableFields);
}
#endregion
public PXSelect<ZZCustomerDealerExt,Where<ZZCustomerDealerExt.bAccountID,Equal<Current<Customer.bAccountID>>>>
CustomerDealerExt;
}
}