Question

Custom Feature Switch: Field cannot be empty

  • 30 November 2022
  • 16 replies
  • 165 views

Userlevel 2
Badge

When adding a new custom feature switch i get an error when changing another feature due to the null value in the new feature switch field. How can i prevent this?

[PXDefault(false, PersistingCheck = PXPersistingCheck.Nothing)] doesn’t help here!

 

 


16 replies

Userlevel 5
Badge +1

I have always used CustomPlugin class to set the values in the db. Essentially ran the sql equivalent of:

update featuresset set Newfield=false where Newfield is null 

 

When you publish the vales will be set to whatever you want the defaults to be, and once set, even if the customplugin runs again, nothing happens as your filter is for when there is no value.

Userlevel 2
Badge

@Shawn Burt this could be a solution but i can’t beleve that there isn’t a more simple approach.

Userlevel 5
Badge +1

The problem I found is that the default tools are for new records, given that featuresset only has one record, the default doesn't seem to work correctly.  Not sure but think it's related to how the screen and the feature attribute works. 

Userlevel 2
Badge

For existing records with uninitialized user fields we have “[PXDefaultAttribute(PersistingCheck = PXPersistingCheck.Nothing)]”. But unfortunately this doesn’t work here.

Userlevel 5
Badge +1

Yeah, it's like the feature attribute overrides that,  that's why i had to set the values in the CustomPlugin 

Userlevel 7
Badge +5

@priekenberg40  I’d like to make sure that the feature switch you are adding is confirmed with your Technical Account Manager at Acumatica. Because the feature switches are controlled by Acumatica licensing server, if it is not registered in the licensing server you’ll not be able to activate this feature in a licensed Acumatica instance.

Userlevel 7
Badge +17

Hi @priekenberg40  Yes, as indicated by Dmitrii, this customization normally will work with the trial version license, to work with the real Acumatica license, we need to inform to Acumatica add this module/integration in the license and whoever buys this module will get this feature.

 

For the customization, you can refer - https://asiablog.acumatica.com/2021/10/add-new-custom-feature-to-the-enable-disable-features-screen-cs100000.html 

Userlevel 2
Badge

@Dmitrii Naumov we are developing extensions for Haufe.X360 (Germany). No issue there.

Userlevel 2
Badge

@Naveen Boga This is no issue here. The setup of the custom feature switch is done already, as shown in initial post. The problem is the null value in the new user field in the FeatureSet record.

Userlevel 7
Badge +17

@priekenberg40  As I indicated in my blog post, can you please try like below.

  [Feature(false, typeof(FeaturesSet.commerceIntegration), null, DisplayName = "New Feature")]

 

Above, the highlighted text is missing your DAC file. Which is the default value for the field.

 

Userlevel 2
Badge

@Naveen Boga i also tried it with setting default value to false first. Same result.
Screenshot is from the last of several tries.

Userlevel 7
Badge +17

@priekenberg40  That should work and it is working for me with the same code.

Not sure why it is not working for you, please reach out to the Acumatica support team by creating a support case OR @Dmitrii Naumov can help you with this.

 

Userlevel 2
Badge

@Naveen Boga  Are you sure? You create a new switch and then enable/disable another feature switch in CS.10.00.00 and leave the new one untouched and don’t get an error?

Userlevel 2
Badge

FeatureAttribute constructor needs one change:
 

 

Userlevel 7
Badge +17

Yes, @priekenberg40  I did not see any issues.

I don’t think any changes are required to the FeatureAttribute.

if we provide like the below at the DAC level, internally automatically it will invoke the constructor and taken care of the default value as FALSE

[Feature(false, typeof(FeaturesSet.commerceIntegration), null, DisplayName = "New Feature")]

 

Userlevel 2
Badge

@Naveen BogaOkay, if you don’t see any issues it may be related to multi language or to our local version here in Germany (Haufe.X360). Reproduced in 2021 R2 and 2022 R1.

@Shawn Burt, which version are you using when you face this issue? Are you using multi language?

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