Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

How best to update JavaScript while migrating CRM 2013 to CRM 2016 Online

$
0
0

Hi,

I am having the following JavaScript which is using XrmSvcToolkit method retrieveMultiple when a Boolean field is changed on the case form.

I have updated the XrmSvcToolkit from V0.2 to V2.2.1 including the Jquery and Json files but I am getting the error as ' XrmSvcToolkit' is undefined' could you please suggest how best I can update the XrmSvcToolkit without breaking the existing or do I need to change anything after updating the XrmSvcToolkit library also I have noticed in the library we have to use as 'XrmServiceToolkit.Rest.RetrieveMultiple'  is that correct?

CrmContext.RetrieveUnknownOrganisation = function () {
        if (CrmContext.UnknownOrganisation != null)
            return CrmContext.UnknownOrganisation;
        Entities.Account.LogicalEntityName;
        var AccountSelectQuery = [Entities.Account.AccountId, Entities.Account.Name].join(',');
        var Account_ODataQFilter = "?$orderby=" + Entities.Account.Name + "&$filter=Name eq 'Unknown'";

        XrmSvcToolkit.retrieveMultiple({
            entityName: "account",
            select: AccountSelectQuery,
            odataQuery: Account_ODataQFilter,
            expand: "",
            async: false,
            successCallback: function (responseReq) {
                if (responseReq != null) {
                    CrmContext.UnknownOrganisation = responseReq[0];
                }
            },
            completionCallback: function () {
            },
            errorCallback: function (e) {
                alert('Error when trying to retrieving unknown organisation:' + e);
            }
        });

        return CrmContext.UnknownOrganisation;
    };

OOn the Case Form, function as below
  CaseForm.IsUnknownContactOrOrganisationOnChange = function () {

        var isUnknownOrganisationFlag = Xrm.Page.getAttribute(Entities.Incident.IsUnknownOrganisation.toLowerCase()).getValue();
        var isUnknownContactFlag = Xrm.Page.getAttribute(Entities.Incident.IsUnknownContact.toLowerCase()).getValue();

        if (isUnknownOrganisationFlag == true) {
            CrmContext.RetrieveUnknownOrganisation();
        }
}




Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>