Solved

PXAccess.FeatureInstalled always returns "False"

  • 31 December 2022
  • 13 replies
  • 216 views

Userlevel 7
Badge +8

Hello Everyone,

I have an Extension that I would like to Activate based on the Value from the FeaturesSet. I have added a DAC Ext to the FeaturesSet “HCLSMFeaturesSet.usrHCLEnhancedApproval” but when I try to get its value whether or not it is true always returns false even when I know for sure it is true (I checked both DB and Enable Feature screen). Any thought why?

public class HCLAPInvoiceEntry : PXGraphExtension<APInvoiceEntry>
{
public static bool IsActive()
{
//Either
return PXAccess.FeatureInstalled<HCLSMFeaturesSet.usrHCLEnhancedApproval>();
//Or
return PXAccess.FeatureInstalled(typeof(HCLSMFeaturesSet.usrHCLEnhancedApproval).Name);
}
}

 

icon

Best answer by Dmitrii Naumov 10 January 2023, 16:20

View original

13 replies

Userlevel 7
Badge +8

Any help is greatly appreciated

@Dmitrii Naumov @smarenich @vkumar @Naveen Boga 

 

Userlevel 7
Badge +5

I see only two possibilities here:

  1. There is some licensing involved. For default Acumatica licensing the feature will also not be visible on Enable/Disable features, but in your case it’s not default Acumatica licensing, but Lexware licensing, right? Does it behave the same way in local pure Acumatica unlicensed instance?
  2. Some caching issue. Restarting application should help if that’s the case. 
Userlevel 7
Badge +8

@Dmitrii Naumov Thanks for your comment.

  1. I am testing on my local instance. Everything is on my local machine I use for development and yes it is Acumatica’s two-user limited version which is typically fully functional. I am adding the field to FeaturesSet myself and I want to get my own added field True/False value from the FeaturesSet.
  2. I have reset both caches and have restarted the application and IIS and browser and … but no luck. 

 

As a workaround I have created the below method that returns the correct value

public static bool IsApprovalWorkflowEnabled(string ApprovalWorkflow)
{
FeaturesMaint Base = PXGraph.CreateInstance<FeaturesMaint>();
FeaturesSet setup = PXSelectReadonly<FeaturesSet>.Select(Base);
HCLSMFeaturesSet setupExt = setup.GetExtension<HCLSMFeaturesSet>();

//Rest of code here

return setupValue;
}

that I call it as follows in my extensions 

public static bool IsActive() => IsApprovalWorkflowEnabled(HCLEPWorkflows.EnhancedWorkflow);

but Acumunator doesn’t like it  saying

// Acuminator disable once PX1056 PXGraphCreationInIsActiveMethod [Justification]

 

Userlevel 7
Badge +5

I think it worth investigating. 

By the way, do you have Features.xml file as an embedded resource in your dll?

Userlevel 7
Badge +8

Thanks @Dmitrii Naumov 

Not sure how I can investigate it more really otherwise I wouldn’t reach out.

Yes I do,

<?xml version="1.0" encoding="utf-8"?>
<Features Type="HCL.HCLSMFeaturesSet" Key="0">
<Feature Name="UsrHCLAdvanceApproval">
<Access ScreenID="HC2050PL"/> <!-- EP Approval Routes -->
<Access ScreenID="HC205000"/> <!-- EP Approval Routes -->
<Access ScreenID="HC403010"/> <!-- EP Documents Pending Approval -->
</Feature>

<Feature Name="UsrHCLProjectCashflowProjection">
<Access ScreenID="HC2020PL"/> <!-- PM Project Cashflow Curves -->
<Access ScreenID="HC202000"/> <!-- PM Project Cashflow Curves -->
<Access ScreenID="HC3020PL"/> <!-- PM Project Cashflow Projections -->
<Access ScreenID="HC302000"/> <!-- PM Project Cashflow Projections -->
</Feature>

<Feature Name="UsrHCLProjectLetterOfCredit">
<Access ScreenID="HC3010PL"/> <!-- PM Letter Of Credit and Deposits -->
<Access ScreenID="HC301000"/> <!-- PM Letter Of Credit and Deposits -->
</Feature>

<Feature Name="UsrHCLProjectScreensEnhancement">
<Access ScreenID="HC2010PL"/> <!-- PM Project Attributes and Properties -->
<Access ScreenID="HC201000"/> <!-- PM Project Attributes and Properties -->
</Feature>
</Features>

 

Userlevel 7
Badge +5

And is it in your root project folder (and is project name =HCL?)?

Userlevel 7
Badge +8

My Project name is “HCLApprovalWorkflow” and the name space I am using is “HCL”. 

Yes, it is in the project’s root folder.

Userlevel 7
Badge +5

Well, in that case this is probably the issue. 

For features.xml the path should match the namespace, so ProjectName/features.xml should give you RootNamespace.FeaturesExtension namespace, where RootNamespace=ProjectName. In your case it does not match each other.

Userlevel 7
Badge +8

@Dmitrii Naumov Sorry I couldn’t comprehend

Question 1) 

The Features.xml path is “HCLApprovalWorkflow/Features.xml”

My Project name is “HCLApprovalWorkflow” and the name space I’m using across all my projects is “HCL” so my project FeaturesSet extension in being created as “HCL.HCLSMFeaturesSet”.

from your writing, my understanding is if I change the FeaturesSet extension workspace to “HCLApprovalWorkflow.HCLSMFeaturesSet” and put it inside the Features.xml for the Type Value it should fix the issue. Am I understanding correctly?

I tried this and didn’t work.

 

Question 2)

If I get rid of “HCLApprovalWorkflow/Features.xml”, do I still need to make this change or doesn’t matter anymore? I removed the Features.xml from project and didn’t make any difference either.

 

Userlevel 7
Badge +5

Given that you have the Features.xml path =“HCLApprovalWorkflow/Features.xml”, you should have the following:

 

 FeaturesSet extension name =  “HCLApprovalWorkflow.HCLSMFeaturesSet”

In the features.xml <Features Type="HCLApprovalWorkflow.HCLSMFeaturesSet" Key="0">

 

Also, the features.xml should be set to be embedded resource in your dll.

 

 

If that does not help, I’d suggest you to create a support case for proper investigation and debugging from our side.

Userlevel 7
Badge +8

@Dmitrii Naumov Thank you for your time. I tried but didn’t work. My account is not linked to a client or partner to be able to create a support ticket. Thank you for the time. I will flag your last response as best answer to close this post but the issue still exist.

Userlevel 7
Badge +8

Sorry @Chris Hackett Can you please change the correct answer to @Dmitrii Naumov last response. I clicked accidently while my screen refreshing. Thank you.

Userlevel 7
Badge

@aaghaei done 😀

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