locked
How to auto populating the field in MS crm RRS feed

  • Question

  • How to auto populating the field in MS crm
    Wednesday, February 4, 2015 10:57 PM

All replies

  • Hi,

    To populate URL of account based on account name please refer this link.

    If you are asking about the address auto populate/complete refer this link

    To Retrieve from other entity and populate the fields, for example on entering the account name in opportunity form the fields from account form like Sector, Region can be retrieved and can be auto populated in opportunity form using Odata as follows.

    Call the function getAccountDetails in onchange event of Companyname. Do not forget to add Jquery and Json in libraries.

           

    function getAccountDetails() {
        var companyName = Xrm.Page.getAttribute("customerid").getValue();
        if ((companyName != null)) {
            var companyNameValue = companyName[0].name;
            var companyNameID = companyName[0].id;

            var serverUrl = Xrm.Page.context.getServerUrl();
            //The XRM OData end-point
            var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";


            var odataSetName = "AccountSet";

            var odataSelect = serverUrl + ODATA_ENDPOINT + "/" + odataSetName + "(guid'" + companyNameID + "')";

            //alert(odataSelect);

            $.ajax({
                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_account = data.d;
                    var name;
                    var Id;
                    var entityType;

                    //replace the fields with the fields on your entity
                    Xrm.Page.getAttribute("new_sector").setValue(result_account.new_Sector.Value);
                    Xrm.Page.getAttribute("new_region").setValue(result_account.new_Region.Value);                     
                },
                error: function (XmlHttpRequest, textStatus, errorThrown) { alert('OData Select Failed: ' + odataSelect); }
            }
            );
        }
    }

    Also as another option if you donot wat the java script then you can go for a workflow to poplate, please refer this link:  https://www.powerobjects.com/blog/2013/11/25/retrieving-data-from-a-related-entity-crm-2013/


    Regards, Rekha.J


    Thursday, February 5, 2015 4:16 AM
  • In addition to above, you can also refer this link



    Microsoft Dynamics CRM Training|Our Blog | Follow US | Our Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Saturday, February 14, 2015 2:59 PM
    Moderator