How to auto populate values on the form based on a value from another form. RRS feed

  • Question

  • Hi guys 

    I have an entity known as booking screen with some fields including booking number, first name, last name etc

    I want to add a text field in another entity (medical) form where if I put the booking number, the name fields should auto populate in that form based on the booking number value and data from the first form. 

    Here is my code, but the issue is it is not populating anything on my medical form.

    function getContactDetails()
        var lookUpObjectValue = Xrm.Page.getAttribute("inmate_lookupbookingscreen").getValue();
        if ((lookUpObjectValue != null))
            var lookuptextvalue = lookUpObjectValue[0].name;
            var lookupid = lookUpObjectValue[0].id;
        var serverUrl = Xrm.Page.context.getServerUrl();
        //The XRM OData end-point
        var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";
        var odataSelect = serverUrl + ODATA_ENDPOINT + "/" + "(guid'" + lookupid + "')";
            type: "GET",
            contentType: "application/json; charset=utf-8",
            datatype: "json",
            url: odataSelect,
            beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Accept", "application/json"); },
            success: function (data, textStatus, XmlHttpRequest) {
                 var result_contact= data.d;
                            //replace the fields with the fields on your entity

            error: function (XmlHttpRequest, textStatus, errorThrown) { alert('OData Select Failed: ' + odataSelect); }

    Monday, August 5, 2013 11:11 AM

All replies

  • You need to use the schema name and not the logical name.


    Go to your entity in solution - Entity > Fields and have a look at the schema name for firstname.

    For example, the logical name for postal code in the contact entity is:


    but the schema name is


    • Edited by KKHAN1991 Monday, August 5, 2013 8:50 PM
    • Proposed as answer by Minal Dahiya Monday, August 5, 2013 10:47 PM
    Monday, August 5, 2013 8:49 PM
  • I have already done that but its still not getting me anything my schema name is 



    Tuesday, August 6, 2013 6:26 AM