Skip to main content
Solved

Override AccountAttribute

  • February 8, 2023
  • 4 replies
  • 152 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();

 

 

 

Best answer by Naveen Boga

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)
        {
        }

 

View original
Did this topic help you find an answer to your question?

4 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3404 replies
  • Answer
  • February 8, 2023

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)
        {
        }

 


  • Author
  • Freshman II
  • 6 replies
  • February 8, 2023

 

 

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

 

 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3404 replies
  • February 8, 2023

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

 

 


  • Author
  • Freshman II
  • 6 replies
  • February 8, 2023

Thanks @Naveen Boga ,

 

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings