CRM 2013: Need Help Populating Address Fields When a New Case is Created RRS feed

  • Question

  • Hello,

    I am attempting to populate address fields contained in the "account record" for new "case: records when the users select the account in the "case" form. I would rather create the cases in the form versus going into the "account record" and adding it there. I have been looking around for several days and it appears Javascript is the way to go. Unfortunately, I don't know anything about programming, but would like to learn so I can make custom changes to my organizations CRM system. 

    I was able to set up the proper relationships and mapped the fields over, but they only populate when the "case" is created from within the "account record" and not when clicking "new case" from the cases area under service.

    Any help would be greatly appreciated, thank you.


    • Edited by MZ_Ultra Tuesday, March 25, 2014 1:27 AM .
    Tuesday, March 25, 2014 1:25 AM

All replies

  • You can you a workflow (real-time or background) to pull the address data from the Account to fields on the Case. Another alternative if you only need to look at the data rather than use it in a report, view, etc... with Case is to embed a Quick View form from the Account record into the Case form. 

    If you want to use JavaScript you can make a call to the REST endpoint and get the the data dynamically you could do something like this:

    var customer = Xrm.Page.getAttribute("customerid").getValue();
    if (customer === null)
    if (customer[0].entityType !== "account")
    var req = new XMLHttpRequest();
    req.open('GET', encodeURI(Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/AccountSet(guid'" + customer[0].id + "')?$select=Address1_City,Address1_Line1"), true);
    req.setRequestHeader('Accept', 'application/json');
    req.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
    req.onreadystatechange = function () {
        if (this.readyState === 4) {
            req.onreadystatechange = null;
            if (this.status === 200) {
                var result = JSON.parse(req.responseText).d;
            else {


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Tuesday, March 25, 2014 1:37 AM