Search code examples
dynamics-crmdynamics-crm-2015

Maintenance Level no longer auto-populate when adding new Case


We have recently migrated from CRM 2013 to CRM 2015 and notice the 'Maintenance Level' no longer auto-populates when selecting an account/business field in a new case. This is the Case:Information form not the new Case Form. The account field clearly shows an onchange event to update maintenance level to match the service level in the function call.   enter image description here

Maintenance Level Properties

enter image description here

function setMaintLevelFromAccount(){

if (SDK.REST){

    // only set if not already populated.

    var custID = Xrm.Page.getAttribute("customerid").getValue();

    var maintLevel = Xrm.Page.getAttribute("contractservicelevelcode").getValue();



    // if customer is populated and maint level is blank, default maint level from account

    if (custID != null){

        var odataOptions = "";

            //odataOptions = "$select=Name,PriceLevelId&$filter=Name eq '" + custID. + "' and StateCode/Value eq 0";

            odataOptions = "$select=am_servicelevel&$filter=AccountId eq guid'" + custID[0].id + "'";

        try {

            SDK.REST.retrieveMultipleRecords("Account", odataOptions, 

                function (data){

                    // if zero results and had name, try running with no name to get the latest.. 

                    if (data.length > 0){

                        var maint = data[0].am_servicelevel.Value;



                        Xrm.Page.getAttribute("contractservicelevelcode").setValue(maint);



                    }

                    else {

                         Xrm.Page.getAttribute("contractservicelevelcode").setValue(null);

                    }

                }, 

                function (error){

                    // alert ("error: " + error.message);

                }, 

                function (complete){

            });

        }

        catch (err) {



        }

    }

  }
}

Is this a known issue? We did apply 0.1 update to resolve the issue with Activities Showing Offline but no further updates have been applied yet.


Solution

  • getServerUrl() had been deprecated. Changing to getClientUrl() in js resolves the issue.