locked
PriceList (GUID) Used in a Solution Not Found on Target System RRS feed

  • Question

  • Hello,

    I made some changes to the default values on a form as part of a solution. The target system had an exact replica of the default value items...but of course they had different guids under the covers.

    So when the solution is published all is well. When the form is opened (new record started etc. ) the default values show but then I get an error about record not found. The guid(s) for the error messages match with the guids on the development system of those default values.

    Fixing was easy enough as I updated the default values on the production system in the settings / administration area by simply selecting the same item thus updating the reference with the guid on the production system.

    My question is how should I have done this...or is it a general rule to not publish default values instead leaving that to the company to do as part of the deployment?

    Wednesday, February 12, 2014 7:21 PM

Answers

  • Hi,

    This is a common issue and it's just the way CRM operates unfortunately. All you can do is try to work around defining specific record values in forms and other areas such as workflow. For workflow you should try to use dynamic values where possible, however if you simply cannot get around it then it simply needs to be a step in your deployment checklist to replace the default values with those that exist in the target system before publishing/activating.

    Rob


    MCTS. GAP Consulting Ltd. Microsoft Community Contributor Award 2011 & 2013

    Wednesday, February 12, 2014 7:40 PM
  • Probably the better option is what Rob suggests - but if you need to get the value dynamically you could always use the oData endpoint to query the value. If you have only 1 Price List it is pretty straight forward:

    var req = new XMLHttpRequest();
    req.open('GET', encodeURI(Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/PriceLevelSet?$select=Name,PriceLevelId"), 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 returned = JSON.parse(req.responseText).d;
                var results = returned.results;
                var Name = results[0].Name;
                var PriceLevelId = results[0].PriceLevelId;
            }
            else {
                alert(this.statusText);
            }
        }
    };
    req.send();


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Wednesday, February 12, 2014 7:55 PM
    Moderator

All replies

  • Hi,

    This is a common issue and it's just the way CRM operates unfortunately. All you can do is try to work around defining specific record values in forms and other areas such as workflow. For workflow you should try to use dynamic values where possible, however if you simply cannot get around it then it simply needs to be a step in your deployment checklist to replace the default values with those that exist in the target system before publishing/activating.

    Rob


    MCTS. GAP Consulting Ltd. Microsoft Community Contributor Award 2011 & 2013

    Wednesday, February 12, 2014 7:40 PM
  • Probably the better option is what Rob suggests - but if you need to get the value dynamically you could always use the oData endpoint to query the value. If you have only 1 Price List it is pretty straight forward:

    var req = new XMLHttpRequest();
    req.open('GET', encodeURI(Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/PriceLevelSet?$select=Name,PriceLevelId"), 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 returned = JSON.parse(req.responseText).d;
                var results = returned.results;
                var Name = results[0].Name;
                var PriceLevelId = results[0].PriceLevelId;
            }
            else {
                alert(this.statusText);
            }
        }
    };
    req.send();


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Wednesday, February 12, 2014 7:55 PM
    Moderator
  • Now there is an interesting thought. I could develop a checklist of my default values. I could deploy a DEACTIVATED workflow to update said default values or do it through odata calls as your example.....hmmmm complexity goes up but could reduce a lot of deployment errors.
    Wednesday, February 12, 2014 9:36 PM