title: How to edit the CashAccount attribute globally
body: <p>I need to add two inner joins and a Where clause to any search that is used on a CashAccount attribute.  I want to make this change globally so that all fields that have the CashAccount attribute are limited by the Where clause that I want to add.  I'm trying to avoid having to hunt down every field that has the CashAccount attribute and either change the Search&lt;&gt; that it's using or replace the CashAccount attribute with a custom one.  Is it possible?</p>
  <p>For instance, on this constructor for the CashAccount attribute, I want to add 2 Inner Joins and a Where to the &quot;search&quot; parameter that is passed in to the constructor.</p>
  <pre><code>    /// &lt;summary&gt;
      /// Constructor of the new CashAccountAttribute object. Filter by branch, doesn't suppress &lt;see cref=&quot;CashAccount.Active&quot;/&gt; status verification.
      /// &lt;/summary&gt;
      /// &lt;param name=&quot;branchID&quot;&gt;Identifier for the branch.&lt;/param&gt;
      /// &lt;param name=&quot;search&quot;&gt;The type of search. Should implement &lt;see cref=&quot;IBqlSearch&quot;/&gt; or &lt;see cref=&quot;IBqlSelect&quot;/&gt;&lt;/param&gt;
      public CashAccountAttribute(Type branchID, Type search) : base(branchID, search)
      {
      }
  </code></pre>
  <p>I've tried overriding the CacheAttached event in order to append two joins to the search that is passed into my custom attribute but, this is giving an error on Cash Sale screen when I select the Customer for the Cash Sale.  I made this change on the Cash Sale screen only.  I replaced the CashAccount attribute and replaced it with a custom attribute that inherits the CashAccount attribute.</p>
  <pre><code>    public override void CacheAttached(PXCache sender)
      {
          base.CacheAttached(sender);
  
          BqlCommand oldbql = this.SelectorAttribute.GetSelect();
          BqlCommand newbql = BqlCommand.AppendJoin(oldbql, typeof(InnerJoin&lt;Branch, On&lt;Branch.branchID, Equal&lt;Current&lt;CashAccount.branchID&gt;&gt;&gt;&gt;));
          newbql = BqlCommand.AppendJoin(newbql, typeof(InnerJoin&lt;Organization, On&lt;Organization.organizationID, Equal&lt;Current&lt;Branch.organizationID&gt;&gt;&gt;&gt;));
          
          this._Attributes.Remove(this.SelectorAttribute);
          PXDimensionSelectorAttribute selectorAttr = new PXDimensionSelectorAttribute(&quot;CASHACCOUNT&quot;,newbql.GetType());
          this._Attributes.Add(selectorAttr);
  
          
      }
  </code></pre>
  <p>Any ideas would be great.</p>
  <p>TIA!</p>