title: In acumatica, how can I grab the value of a selector and use it to fill another field?
body: <p>As seen in the image below, I want to try and pass the value of the Selector to the Attention field. I'm trying to make it so that whenever I choose a new selector value, the Attention field will be updated with the selector's value.</p>
  <p><a href="https://i.stack.imgur.com/U1Zgy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U1Zgy.png" alt="Contact Selection" /></a></p>
  <p>The Contact Selector in the image above is a Custom Field, so I was trying to access it through it's extension. However, I couldn't seem to get it working.</p>
  <p>Here is the Data Access screen showing how the field is set up:</p>
  <p><a href="https://i.stack.imgur.com/cC9Tp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cC9Tp.png" alt="Data Access screen" /></a></p>
  <br/>
  <p>Here is the code so you can grab it if needed:</p>
  <pre><code>[PXDBString(50)]
  [PXUIField(DisplayName=&quot;Contact&quot;)]
  [PXSelector(typeof(Search2&lt;Contact.displayName,
  LeftJoin&lt;BAccount, On&lt;BAccount.bAccountID, Equal&lt;Contact.bAccountID&gt;&gt;&gt;,
  Where&lt;Contact.contactType, Equal&lt;ContactTypesAttribute.person&gt;&gt;&gt;))]
  [PXRestrictor(typeof(
      Where&lt;Current&lt;PMContact.customerID&gt;,
              Like&lt;Contact.bAccountID&gt;&gt;), &quot;&quot;)]
  </code></pre>
  <p>Below are my two attempts of trying to grab the extension. I've tried using these pieces of code in various events; RowSelected, RowUpdated, FieldUpdated. Nothing seemed to work, which obviously means I'm not grabbing the extension properly, but I'm not sure what else to try.</p>
  <p><strong>Attempt 1</strong></p>
  <pre><code>protected void PMContact_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
  {  
     var row = (PMContact)e.Row;
  
     if (row == null) return;
  
     PMContactExt rowExt = row.GetExtension&lt;PMContactExt&gt;();
  
     if (rowExt != null) {
       row.Attention = rowExt.UsrContactSelect;
     }   
  }
  </code></pre>
  <p><strong>Attempt 2</strong></p>
  <pre><code>protected void PMContact_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
  {
        
     var row = (PMContact)e.Row;
  
     if (row == null) return;
  
     PMContact items = (PMContact)Base.ItemSettings.Current;
     var itemExt = PXCache&lt;PMContact&gt;.GetExtension&lt;PMContactExt&gt;(items);
        
     row.Attention = itemExt.UsrContactSelect;  
  } 
  </code></pre>
  <p>This attempt was giving me an error about the ItemSettings part:</p>
  <blockquote>
  <p>\App_Code\Caches\ProjectEntry.cs(43): error CS1061: 'ProjectEntry' does not contain a definition for 'ItemSettings' and no accessible extension method 'ItemSettings' accepting a first argument of type 'ProjectEntry' could be found (are you missing a using directive or an assembly reference?)</p>
  </blockquote>
  <p>I'm a bit stuck on what else I can try to make this happen.</p>
  <p>Do you have any other suggestions? :)</p>