locked
CRM 2013 - Want to auto-populate address and other information when potential customer is selected. RRS feed

  • Question

  • This is when Sales -> Quotes is selected.

    I also want to populate the freight data and a few other things, but I assume once I know how to populate one field figuring out the others are menial.

    Wednesday, March 19, 2014 1:18 AM

All replies

  • Look into using the REST endpoint in the SDK if you want to use JavaScript

    Just as example of getting the Account Number from an Account based on it's Id

    var req = new XMLHttpRequest();
    req.open('GET', encodeURI(Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/AccountSet(guid'64791BDB-A0AE-E311-8A9D-6C3BE5A8CA94')?$select=AccountNumber"), 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;
                var AccountNumber = result.AccountNumber;
            }
            else {
                alert(this.statusText);
            }
        }
    };
    req.send();


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Wednesday, March 19, 2014 1:31 AM
    Moderator
  • Thanks. I'm new to Dynamic CRM. Is Javascript the only way to get the information I need?
    Wednesday, March 19, 2014 1:57 AM
  • You could use a workflow to update a Quote. You could populate a field based on a field from a related entity which is contain in a lookup on the Quote (same data type).

    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Wednesday, March 19, 2014 2:39 AM
    Moderator
  • I think workflow is the way I'm going to go.

    I've created a workflow and I've set it to run when the potential customer field changes.

    I've set it to Update Quote under the steps.

    In the following screen, where I set the value, I can't select the related entity. Nothing is populated in the dropdown to choose.

    I assume it's a datatype issue, but the details for the field and for the account make it seem as if the datatypes are the same.

    The data types are picklist for what it's worth. Do you know of any reason why this might be happening?


    • Edited by bdmcleod Wednesday, March 19, 2014 2:12 PM wrong data type
    Wednesday, March 19, 2014 1:56 PM
  • It helps when the you define a global option set for values you want to share across records. that way the underlying value is the same between both lists. 

    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Wednesday, March 19, 2014 2:21 PM
    Moderator
  • The option set is global. I still can't assign the account's shipping method, for example, to the corresponding shipping method field in the quote via the Potential Customer (Account) related entity.

    Wednesday, March 19, 2014 2:56 PM