{"id":2615,"date":"2023-07-10T12:47:02","date_gmt":"2023-07-10T07:47:02","guid":{"rendered":"https:\/\/omar-iqbal.com\/?p=2615"},"modified":"2023-11-23T19:06:42","modified_gmt":"2023-11-23T14:06:42","slug":"set-lookup-in-microsoft-dynamics-ce-crm-using-javascript","status":"publish","type":"post","link":"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/","title":{"rendered":"Set lookup in Microsoft Dynamics CE (CRM) using JavaScript"},"content":{"rendered":"\n<p>Today we will be going over the steps how to set the value of a look up using JavaScript in Microsoft Dynamics CE (CRM).<\/p>\n\n\n\n<p>I have created a custom table named as Student. It has the relation with the Contact table. The student table has Email field.<\/p>\n\n\n\n<p>When I create new Student record and write the email of that student, it should automatically fill the Contact lookup by matching the contact with the same email.<\/p>\n\n\n\n<p>How can I do that using JavaScript.<\/p>\n\n\n\n<p>To do that I will create a Web source and attached the JavaScript file in which we can achieve that part.<\/p>\n\n\n\n<ol class=\"is-style-cnvs-list-styled-positive cnvs-block-core-list-1688661328645 wp-block-list\">\n<li>First create a JavaScript file in notepad and save it as .js file.<\/li>\n\n\n\n<li>Write a method in JavaScript to attach it to the Email field OnChange event and pass executionContext to this method. This method will fetch the email value entered in the field and pass formContext and email field value to another method named as <strong>RetrieveContactRecord<\/strong>, we will be creating this method in the next step.<\/li>\n\n\n\n<li><pre class=\"wp-block-preformatted\">function onChangeEmail(executionContext) {     <br>var formContext = executionContext.getFormContext();     <br>var emailElement = formContext.getAttribute(\"cr57c_email\");     <br>var emailValue = emailElement.getValue();     <br><br>RetrieveContactRecord(formContext, emailValue); <br>} <\/pre><\/li>\n\n\n\n<li>To explain the above code, the email field schema name is used in line 3 you can see the schema name in the table column, see below screenshot from where you can find the schema name of a field.<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"274\" class=\"wp-image-2622\" style=\"width: 600px;\" src=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_1.jpg\" alt=\"\" srcset=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_1.jpg 1887w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_1-300x137.jpg 300w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_1-1024x467.jpg 1024w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_1-768x350.jpg 768w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_1-1536x701.jpg 1536w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_1-380x173.jpg 380w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_1-800x365.jpg 800w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_1-1160x529.jpg 1160w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/li>\n\n\n\n<li>Write another method named as <strong>RetrieveContactRecord<\/strong> which is used to fetch the contact record by the email value if any contact exists with this email it returns that contact or else it returns nothing. This method takes formContext and email value as parameters.<\/li>\n\n\n\n<li><pre class=\"wp-block-preformatted\">function RetrieveContactRecord(formContext, email) {      <br><br>var url  = formContext.getUrl().split('com\/')[0] +\"com\"; <br>var oDataUrl = url+\"\/api\/data\/v9.2\/contacts?$filter=emailaddress1%20eq%20%27\"+email+\"%27&amp;$select=contactid,yomifullname\";         <br><br>var retrieveReq = new XMLHttpRequest();         <br>retrieveReq.open(\"GET\", oDataUrl, false);         <br>retrieveReq.setRequestHeader(\"Accept\", \"application\/json\");         <br>retrieveReq.setRequestHeader(\"Content-Type\", \"application\/json;charset=utf-8\");         <br><br>  retrieveReq.onreadystatechange = function ()         <br> {     <br><br>    if (retrieveReq.readyState == 4 &amp;&amp; retrieveReq.status == 200)             <br>    {                 <br>       var result = JSON.parse(retrieveReq.responseText);   <br><br>       if (result.value.length &gt;= 1) <br>       {                   <br>         setContactOnStudent(formContext, result.value[0].contactid,  result.value[0].yomifullname); <br>       }             <br>    }         <br>  };         <br><br>   retrieveReq.send(); <br>} <\/pre><\/li>\n\n\n\n<li>To explain the above code, first we fetch the environment URL, then created the OData API URL to get the contact record by email, if the request is a success we passed the formContext, contactid and contact name to another JavaScript method.<\/li>\n\n\n\n<li>In the above method when the contactid and contact name fetched by the API we need to set it to the contact lookup on the student form. To do that we called another function named as <strong>setContactOnStudent<\/strong> in the JavaScript file.<\/li>\n\n\n\n<li><pre class=\"wp-block-preformatted\">function setContactOnStudent(formContext, contactid, name) <br>{ <br>   var lookupData = new Array();      <br>   var lookupItem = new Object();      <br>   lookupItem.entityType = \"contact\";      <br>   lookupItem.id = \"{\"+contactid+\"}\";      <br>   lookupItem.name = name;          <br>   lookupData[0] = lookupItem; <br><br>   formContext.getAttribute(\"cr57c_contact\").setValue(lookupData); <br>} <\/pre><\/li>\n\n\n\n<li>To explain the above code, it creates the array and assign contact id as id field and name field as name field and then assign that lookup to the lookup contact field on the student by its schema name.\\<\/li>\n\n\n\n<li>Once the JavaScript file completed with these three method save it with name  <strong>UpdateContactOnStudent.js<\/strong> .<\/li>\n\n\n\n<li>Go to make.powerapps.com and go to your solution create a Web resource in your solution.<\/li>\n\n\n\n<li>Click New &#8211;&gt; More &#8211;&gt; Web resource<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"372\" class=\"wp-image-2627\" style=\"width: 600px;\" src=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_2.jpg\" alt=\"\" srcset=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_2.jpg 1057w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_2-300x186.jpg 300w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_2-1024x636.jpg 1024w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_2-768x477.jpg 768w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_2-380x236.jpg 380w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_2-800x496.jpg 800w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/li>\n\n\n\n<li>Provide the web resource name and scheme name and select Type as <strong>JavaScript(JS)<\/strong> and click on Choose file button to upload JavaScript file which we created.<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"561\" class=\"wp-image-2628\" style=\"width: 600px;\" src=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_3.jpg\" alt=\"\" srcset=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_3.jpg 996w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_3-300x281.jpg 300w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_3-768x719.jpg 768w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_3-380x356.jpg 380w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_3-800x749.jpg 800w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/li>\n\n\n\n<li>Select the JavaScript file and click Open and Click Save then.<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"334\" class=\"wp-image-2629\" style=\"width: 600px;\" src=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_4.jpg\" alt=\"\" srcset=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_4.jpg 1670w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_4-300x167.jpg 300w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_4-1024x571.jpg 1024w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_4-768x428.jpg 768w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_4-1536x856.jpg 1536w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_4-380x212.jpg 380w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_4-800x446.jpg 800w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_4-1160x647.jpg 1160w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/li>\n\n\n\n<li>Once the web resource is created, we need to open the form in classic view in which we need to add the event. To do that go to the table select the form and then click <strong>Switch to classic<\/strong> button.<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"273\" class=\"wp-image-2632\" style=\"width: 600px;\" src=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_5.jpg\" alt=\"\" srcset=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_5.jpg 1768w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_5-300x136.jpg 300w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_5-1024x465.jpg 1024w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_5-768x349.jpg 768w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_5-1536x698.jpg 1536w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_5-380x173.jpg 380w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_5-800x363.jpg 800w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_5-1160x527.jpg 1160w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"264\" class=\"wp-image-2633\" style=\"width: 600px;\" src=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_6.jpg\" alt=\"\" srcset=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_6.jpg 1395w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_6-300x132.jpg 300w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_6-1024x450.jpg 1024w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_6-768x337.jpg 768w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_6-380x167.jpg 380w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_6-800x352.jpg 800w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_6-1160x510.jpg 1160w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/li>\n\n\n\n<li>Double click on Email field it open a popup, go to the <strong>Events<\/strong> tab and expand <strong>Form libraries<\/strong> then click <strong>Add<\/strong> button<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"293\" class=\"wp-image-2634\" style=\"width: 600px;\" src=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_7.jpg\" alt=\"\" srcset=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_7.jpg 1911w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_7-300x146.jpg 300w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_7-1024x499.jpg 1024w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_7-768x375.jpg 768w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_7-1536x749.jpg 1536w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_7-380x185.jpg 380w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_7-800x390.jpg 800w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_7-1160x566.jpg 1160w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/li>\n\n\n\n<li>Search by entering the name of the web resource as shown in step 19. i.e. <strong>cr57c_UpdateContactOnStudent<\/strong> select it and then click Add.<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"468\" class=\"wp-image-2635\" style=\"width: 400px;\" src=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_8.jpg\" alt=\"\" srcset=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_8.jpg 586w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_8-257x300.jpg 257w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_8-380x444.jpg 380w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/li>\n\n\n\n<li>Now in the event handler tab click on Add button.<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"477\" class=\"wp-image-2637\" style=\"width: 400px;\" src=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_9.jpg\" alt=\"\" srcset=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_9.jpg 752w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_9-252x300.jpg 252w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_9-380x453.jpg 380w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/li>\n\n\n\n<li>Write the function name which we created in Step no. 3 as <strong>onChangeEmail<\/strong> and check this check box <strong>Pass execution context as first parameter<\/strong> to <strong>Yes<\/strong> and click OK and then OK again.<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"462\" class=\"wp-image-2638\" style=\"width: 400px;\" src=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_10.jpg\" alt=\"\" srcset=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_10.jpg 582w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_10-260x300.jpg 260w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_10-380x439.jpg 380w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/li>\n\n\n\n<li>Click on Save and then Publish.<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"460\" class=\"wp-image-2640\" style=\"width: 600px;\" src=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_11.jpg\" alt=\"\" srcset=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_11.jpg 1168w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_11-300x230.jpg 300w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_11-1024x786.jpg 1024w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_11-768x589.jpg 768w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_11-380x292.jpg 380w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_11-800x614.jpg 800w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_11-1160x890.jpg 1160w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/li>\n\n\n\n<li>Go to you model driven application and create a Student record, when you type the email, if the contact of this email exists it will auto assign that Contact to the lookup.<\/li>\n\n\n\n<li>I created a contact named as Omar Iqbal Blogs and its email is inbox@omar-iqbal.com.<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"246\" class=\"wp-image-2642\" style=\"width: 600px;\" src=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_12.jpg\" alt=\"\" srcset=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_12.jpg 1797w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_12-300x123.jpg 300w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_12-1024x420.jpg 1024w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_12-768x315.jpg 768w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_12-1536x630.jpg 1536w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_12-380x156.jpg 380w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_12-800x328.jpg 800w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_12-1160x476.jpg 1160w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/li>\n\n\n\n<li>Now we will create a Student record and enter email address as inbox@omar-iqbal.com so it will auto fill the Contact lookup based on the email id.<\/li>\n\n\n\n<li><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"267\" class=\"wp-image-2644\" style=\"width: 600px;\" src=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_13.jpg\" alt=\"\" srcset=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_13.jpg 1355w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_13-300x133.jpg 300w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_13-1024x455.jpg 1024w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_13-768x341.jpg 768w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_13-380x169.jpg 380w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_13-800x355.jpg 800w, https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/setlookup_13-1160x515.jpg 1160w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/li>\n\n\n\n<li>We achieved our goal.<\/li>\n<\/ol>\n\n\n\n<p>Thank you for reading this article hope you find it useful.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.linkedin.com\/in\/omar-iqbal-here\/\" target=\"_blank\" rel=\"noreferrer noopener\">Omar Iqbal<\/a><\/p>\n\n\n\n<p>Technical Consultant<\/p>\n\n\n\n<ol class=\"is-style-cnvs-list-styled-positive cnvs-block-core-list-1656877132330 wp-block-list\">\n<li><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"Today we will be going over the steps how to set the value of a look up using&hellip;\n","protected":false},"author":1,"featured_media":2647,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[62,18],"tags":[67,68,69,65,66,72,73,70,63,64],"class_list":{"0":"post-2615","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-microsoft-dynamics-ce-crm","8":"category-power-platform","9":"tag-crm","10":"tag-customerengagement","11":"tag-customerrelationshipmanagement","12":"tag-dynamicsce","13":"tag-dynamicscrm","14":"tag-javascript","15":"tag-lookup","16":"tag-microsoftdynamics365","17":"tag-microsoftdynamicsce","18":"tag-microsoftdynamicscrm","19":"cs-entry","20":"cs-video-wrap"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Set lookup in Microsoft Dynamics CE (CRM) using JavaScript - Omar Iqbal&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Set lookup in Microsoft Dynamics CE (CRM) using JavaScript - Omar Iqbal&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"Today we will be going over the steps how to set the value of a look up using&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Omar Iqbal&#039;s Blog\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/umerk26\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-10T07:47:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-23T14:06:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/SetLookupCE.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"518\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"omar_iqbal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/omarshykh\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"omar_iqbal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/\"},\"author\":{\"name\":\"omar_iqbal\",\"@id\":\"https:\/\/omar-iqbal.com\/#\/schema\/person\/bf76b3bc6da3287f49fd4713189accd4\"},\"headline\":\"Set lookup in Microsoft Dynamics CE (CRM) using JavaScript\",\"datePublished\":\"2023-07-10T07:47:02+00:00\",\"dateModified\":\"2023-11-23T14:06:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/\"},\"wordCount\":690,\"image\":{\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/SetLookupCE.jpg\",\"keywords\":[\"CRM\",\"CustomerEngagement\",\"CustomerRelationshipManagement\",\"DynamicsCE\",\"DynamicsCRM\",\"JavaScript\",\"Lookup\",\"MicrosoftDynamics365\",\"MicrosoftDynamicsCE\",\"MicrosoftDynamicsCRM\"],\"articleSection\":[\"Microsoft Dynamics CE (CRM)\",\"Microsoft Power Platform\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/\",\"url\":\"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/\",\"name\":\"Set lookup in Microsoft Dynamics CE (CRM) using JavaScript - Omar Iqbal&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/omar-iqbal.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/SetLookupCE.jpg\",\"datePublished\":\"2023-07-10T07:47:02+00:00\",\"dateModified\":\"2023-11-23T14:06:42+00:00\",\"author\":{\"@id\":\"https:\/\/omar-iqbal.com\/#\/schema\/person\/bf76b3bc6da3287f49fd4713189accd4\"},\"breadcrumb\":{\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/#primaryimage\",\"url\":\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/SetLookupCE.jpg\",\"contentUrl\":\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/SetLookupCE.jpg\",\"width\":518,\"height\":500},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/omar-iqbal.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Microsoft Dynamics CE (CRM)\",\"item\":\"https:\/\/omar-iqbal.com\/index.php\/category\/microsoft-dynamics-ce-crm\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Set lookup in Microsoft Dynamics CE (CRM) using JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/omar-iqbal.com\/#website\",\"url\":\"https:\/\/omar-iqbal.com\/\",\"name\":\"Omar Iqbal&#039;s Blog\",\"description\":\"Associate Technical Consultant\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/omar-iqbal.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/omar-iqbal.com\/#\/schema\/person\/bf76b3bc6da3287f49fd4713189accd4\",\"name\":\"omar_iqbal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/omar-iqbal.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/77c8e6d449070e5f91d3609398694fed75736ca7b40f3b8b29a94259cb446d49?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/77c8e6d449070e5f91d3609398694fed75736ca7b40f3b8b29a94259cb446d49?s=96&d=mm&r=g\",\"caption\":\"omar_iqbal\"},\"sameAs\":[\"https:\/\/omar-iqbal.com\",\"https:\/\/www.facebook.com\/umerk26\",\"https:\/\/www.instagram.com\/omariqbal_here\/\",\"https:\/\/www.linkedin.com\/in\/omar-iqbal-here\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/omarshykh\"],\"url\":\"https:\/\/omar-iqbal.com\/index.php\/author\/omar_iqbal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Set lookup in Microsoft Dynamics CE (CRM) using JavaScript - Omar Iqbal&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/","og_locale":"en_US","og_type":"article","og_title":"Set lookup in Microsoft Dynamics CE (CRM) using JavaScript - Omar Iqbal&#039;s Blog","og_description":"Today we will be going over the steps how to set the value of a look up using&hellip;","og_url":"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/","og_site_name":"Omar Iqbal&#039;s Blog","article_author":"https:\/\/www.facebook.com\/umerk26","article_published_time":"2023-07-10T07:47:02+00:00","article_modified_time":"2023-11-23T14:06:42+00:00","og_image":[{"width":518,"height":500,"url":"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/SetLookupCE.jpg","type":"image\/jpeg"}],"author":"omar_iqbal","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/omarshykh","twitter_misc":{"Written by":"omar_iqbal","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/#article","isPartOf":{"@id":"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/"},"author":{"name":"omar_iqbal","@id":"https:\/\/omar-iqbal.com\/#\/schema\/person\/bf76b3bc6da3287f49fd4713189accd4"},"headline":"Set lookup in Microsoft Dynamics CE (CRM) using JavaScript","datePublished":"2023-07-10T07:47:02+00:00","dateModified":"2023-11-23T14:06:42+00:00","mainEntityOfPage":{"@id":"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/"},"wordCount":690,"image":{"@id":"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/SetLookupCE.jpg","keywords":["CRM","CustomerEngagement","CustomerRelationshipManagement","DynamicsCE","DynamicsCRM","JavaScript","Lookup","MicrosoftDynamics365","MicrosoftDynamicsCE","MicrosoftDynamicsCRM"],"articleSection":["Microsoft Dynamics CE (CRM)","Microsoft Power Platform"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/","url":"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/","name":"Set lookup in Microsoft Dynamics CE (CRM) using JavaScript - Omar Iqbal&#039;s Blog","isPartOf":{"@id":"https:\/\/omar-iqbal.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/#primaryimage"},"image":{"@id":"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/SetLookupCE.jpg","datePublished":"2023-07-10T07:47:02+00:00","dateModified":"2023-11-23T14:06:42+00:00","author":{"@id":"https:\/\/omar-iqbal.com\/#\/schema\/person\/bf76b3bc6da3287f49fd4713189accd4"},"breadcrumb":{"@id":"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/#primaryimage","url":"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/SetLookupCE.jpg","contentUrl":"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2023\/07\/SetLookupCE.jpg","width":518,"height":500},{"@type":"BreadcrumbList","@id":"https:\/\/omar-iqbal.com\/index.php\/2023\/07\/10\/set-lookup-in-microsoft-dynamics-ce-crm-using-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/omar-iqbal.com\/"},{"@type":"ListItem","position":2,"name":"Microsoft Dynamics CE (CRM)","item":"https:\/\/omar-iqbal.com\/index.php\/category\/microsoft-dynamics-ce-crm\/"},{"@type":"ListItem","position":3,"name":"Set lookup in Microsoft Dynamics CE (CRM) using JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/omar-iqbal.com\/#website","url":"https:\/\/omar-iqbal.com\/","name":"Omar Iqbal&#039;s Blog","description":"Associate Technical Consultant","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/omar-iqbal.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/omar-iqbal.com\/#\/schema\/person\/bf76b3bc6da3287f49fd4713189accd4","name":"omar_iqbal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/omar-iqbal.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/77c8e6d449070e5f91d3609398694fed75736ca7b40f3b8b29a94259cb446d49?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/77c8e6d449070e5f91d3609398694fed75736ca7b40f3b8b29a94259cb446d49?s=96&d=mm&r=g","caption":"omar_iqbal"},"sameAs":["https:\/\/omar-iqbal.com","https:\/\/www.facebook.com\/umerk26","https:\/\/www.instagram.com\/omariqbal_here\/","https:\/\/www.linkedin.com\/in\/omar-iqbal-here\/","https:\/\/x.com\/https:\/\/twitter.com\/omarshykh"],"url":"https:\/\/omar-iqbal.com\/index.php\/author\/omar_iqbal\/"}]}},"_links":{"self":[{"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/posts\/2615","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/comments?post=2615"}],"version-history":[{"count":15,"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/posts\/2615\/revisions"}],"predecessor-version":[{"id":2648,"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/posts\/2615\/revisions\/2648"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/media\/2647"}],"wp:attachment":[{"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/media?parent=2615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/categories?post=2615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/tags?post=2615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}