Solved

Override AccountAttribute

  • 8 February 2023
  • 4 replies
  • 108 views

I need to override the accountattribute so that it accepts inactive accounts, how do I do this, currently the restrictors I want to remove…..

 

    [PXDBInt]
    [PXInt]
    [PXRestrictorAttribute(typeof(Where<Account.active, Equal<True>>), "Account is inactive.", new[] { })]
    [PXRestrictorAttribute(typeof(Where<Where<Current<GLSetup.ytdNetIncAccountID>, IsNull, Or<Account.accountID, NotEqual<Current<GLSetup.ytdNetIncAccountID>>>>>), "YTD Net Income Account cannot be used in this context.", new[] { })]
    [PXUIField(DisplayName = "Account", Visibility = PXUIVisibility.Visible, FieldClass = "ACCOUNT")]
   

public class AccountAttribute : AcctSubAttribute, IPXFieldVerifyingSubscriber, IPXRowPersistingSubscriber
    {
        public const string DimensionName = "ACCOUNT";

        public AccountAttribute();

 

 

 

icon

Best answer by Naveen Boga 8 February 2023, 17:25

View original

4 replies

Userlevel 7
Badge +18

Hi @gparrales50  You can write a CacheAttached event with the [PXRemoveBaseAttribute(typeof(PXRestrictorAttribute))] 

 

Below is the sample example for reference.

 

 [PXMergeAttributes(Method = MergeMethod.Merge)]

        [PXRemoveBaseAttribute(typeof(PXRestrictorAttribute))]
        [CustomerActive]

        protected virtual void SOOrder_CustomerID_CacheAttached(PXCache cache)
        {
        }

 

 

 

For some reason the removebaseattribute does not work, since it is implemented by a class, from what I understand, by placing the [Account] attribute the restrict of the AccountId field of the Account Table is triggered

 

CustomClass

 

 

Userlevel 7
Badge +18

Hi @gparrales50  It seems [Account] attribute is decorated with the PXRestrictor. Please find the screenshot

 

 

Thanks @Naveen Boga ,

 

Exactly, that's why I think the PXRemoveBaseAttribute doesn't work for me, how can I bypass that restriction?

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