title: How to update the owner name in custom object based on the mobile no
body: <p>I need to update the owner name based on mobile no present in the custom object.</p>
  
  <p>In the custom object i have the field is called "Referral Id". It's contain the Mobile no,the mobile no already present in user details.In the custom object i need to change the owner name based on the referral id(name).</p>
  
  <p>For example Custom object is created by myself but i put referral id was my manager mobile then it automatically change the lead owner as my manager not me.</p>
  
  <p>I try the following trigger</p>
  
  <pre><code>trigger Ownerupdate on Broker__c (before insert,before update) 
  {
      //instantiate set to hold unique deployment record ids
      Set&lt;Id&gt; deplomentIds = new Set&lt;Id&gt;();
      for(Broker__c s : Trigger.new)
      {
          deplomentIds.add(s.Referral_ID__c);
      }
  
      //instantiate map to hold deployment record ids to their corresponding ownerids
      Map&lt;Id, Referral_ID__c&gt; deploymentOwnerMap = new Map&lt;Id, Referral_ID__c&gt;([SELECT Id, Phone FROM User WHERE Id IN: deplomentIds]);
  
      for (Broker__c s : Trigger.new) 
      {
          if (s.Owner__c == null &amp;&amp; deploymentOwnerMap.containsKey(s.Referral_ID__c)) 
          {
              s.Owner__c = deploymentOwnerMap.get(s.Referral_ID__c).OwnerId;
          }
      }
  }
  </code></pre>
  
  <p>I got the following Error
      Error: Compile Error: Invalid type: Referral_ID__c at line 11 column 62 </p>