Hello All,
I am trying to activate an extension in APInvoiceEntry conditionally based on a setup extension from PreferencesGeneral. In all methods typically I can pass “Base” as a parameter in my code and retrieve the expected data but in “public static bool IsActive()” when I try to pass the Base (in my case APInvoiceEntry) it is not recognized. As an alternative, I tried to directly select from the database but I am not sure why the setup record is returned null and obviously, I can not get the extension from null. I read
public class HCLAPInvoiceEntry : PXGraphExtension<APInvoiceEntry>
{
public static bool IsActive()
{
PreferencesGeneral setup = PXDatabase.SelectMulti<PreferencesGeneral>() as PreferencesGeneral;
HCLSMPreferencesGeneral setupExt = setup.GetExtension<HCLSMPreferencesGeneral>();
return (setupExt != null) ? setupExt.UsrHCLAPInvoiceApprovalWorkflow == HCLEPWorkflows.EnhancedWorkflow : false;
}
}
Best answer by aaghaei
View original