CRM 2011 - Get Attribute from lookup Javascript RRS feed

  • Question

  • Hi,

    I'm currently working on some JavaScript on my account entity, I'm trying to get the first name and last name fields from the primary contact lookup (contact entity) which I will then pass on into a text field on into a text field on the account form, can anyone provide me with the code in order to do this?



    Monday, March 3, 2014 11:40 AM


  • Hi Sam,

    Download the SDK for Dynamics CRM 2011 from here : http://www.microsoft.com/en-us/download/details.aspx?id=24004.You should find a file named "SDK.REST.js" at "SDK\SampleCode\JS\RESTEndpoint\JavaScriptRESTDataOperations\JavaScriptRESTDataOperations\Scripts"

    Use that library Microsoft has provided to make the REST calls. The example of calling the function is present in the JavaScript file in that folder itself. Go through it and you should be able to get the idea of making REST calls using JavaScript. The function you need to use is "retrieveRecord".

    It should be something as follows:

    function retrieveContact(ContactId) {
         function (account) {
          //populate field in Account

    • Marked as answer by samrr1875 Monday, March 3, 2014 4:25 PM
    Monday, March 3, 2014 2:54 PM

All replies