Answers.Body: <p>First, it can't be done without coding and it may not be an easy task.</p>
  
  <p>I can think of 2 possibilities :</p>
  
  <ol>
  <li>Change search api</li>
  </ol>
  
  <p>When you do a search, the api that should be called is Contact.getlist, so the first step is to see if the api is able to do what you want. It seems to be possible to change the search from "name or email" to "external_identifier" but i can't find a way to do "name or email or external_identifier".</p>
  
  <pre><code>$result = civicrm_api3('Contact', 'getlist', array(
    'sequential' =&gt; 1,
    'input' =&gt; 4398,   // the text searched
    'search_field' =&gt; "external_identifier",
  ));
  </code></pre>
  
  <p>The problem i see is, if you change the default api behavior, it will be changed everywhere. I don't think you have the context here.</p>
  
  <p>If you find your way, you will then have to implement the <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_apiWrappers" rel="nofollow">hook_civicrm_apiWrappers</a> to change the api call as needed.</p>
  
  <ol start="2">
  <li>Change the ui</li>
  </ol>
  
  <p>Replace the default CiviCRM search by a custom one that will call a custom api</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-13T17:44:36.337Z
Answers.LastActivityDate: 2015-11-13T17:44:36.337Z
Answers.UserDisplayName: samuelsov
Body: <p>In "New Membership" I need to search the contacts by External ID instead of default "name or email". Is there any smart solution for this?</p>
  
Tags: <civimember><contact-reference>
Title: customize search field in Contact Reference Field
ThreadText: # customize search field in Contact Reference Field
  
  (Asked by: username_0 on 2015-11-13)
  
  In "New Membership" I need to search the contacts by External ID instead of default "name or email". Is there any smart solution for this?
  
  **Tags:** civimember, contact-reference
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-11-13. Score: 1 | Accepted answer
  
  First, it can't be done without coding and it may not be an easy task.
  
  I can think of 2 possibilities :
  
  1. Change search api
  
  When you do a search, the api that should be called is Contact.getlist, so the first step is to see if the api is able to do what you want. It seems to be possible to change the search from "name or email" to "external\_identifier" but i can't find a way to do "name or email or external\_identifier".
  
  ```
  $result = civicrm_api3('Contact', 'getlist', array(
    'sequential' => 1,
    'input' => 4398,   // the text searched
    'search_field' => "external_identifier",
  ));
  
  ```
  
  The problem i see is, if you change the default api behavior, it will be changed everywhere. I don't think you have the context here.
  
  If you find your way, you will then have to implement the [hook\_civicrm\_apiWrappers](http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_apiWrappers) to change the api call as needed.
  
  2. Change the ui
  
  Replace the default CiviCRM search by a custom one that will call a custom api
  
  
  ---
  
  