title: Populate dynamics CRM Activity Type sender from field using custom JavaScript?
body: <p>I am trying to populate the &quot;From&quot; look up field using custom JavaScript in Dynamics CRM.</p>
  <p>I'm new to JavaScript and Dynamics really struggling to do this.</p>
  <p>Below is a screenshot of my code and solution.</p>
  <p><a href="https://i.stack.imgur.com/oxmi2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oxmi2.png" alt="The &quot;From&quot; field apparently this is Activity party type Sender" /></a></p>
  <pre><code>function PopulateFromLookUpField(executionContext) {
  
  var formContext = executionContext.getFormContext();
  
  var value = new Array(); //create a new object array
  value[0] = new Object();
  value[0].id = ; // set ID to ID
  value[0].name = &quot;new_name&quot;; //set name to name
  value[0].entityType = &quot;sender&quot;; //optional
  formContext.getAttribute(&quot;sender&quot;).setValue(value);
  
  }
  </code></pre>
  <p>I also tried the solution below it doesn't work.</p>
  <pre><code>function PopulateFromLookUpField(executionContext) {
  
  
   var lookUpObject.id = ;
     lookUpObject.name = &quot;Joe CRM&quot;;
     lookUpObject.entityType = &quot;sender&quot;;               
     formContext.getAttribute(&quot;sender&quot;).setValue(value);
     
  }
  </code></pre>
  <p>Please advise and help.</p>