Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CRM Upgrade from 2013 to 2016 JavaScript error

(0) ShareShare
ReportReport
Posted on by 195

Hi,

I am getting an following error in JavaScript 1 which refers to JavaScript 2 function.

Error:

8105.Untitled.png

JavaScript 1:

fetchUserInformation: function () {
var UserId = Xrm.Page.context.getUserId();

var fetch = new OrbUtils.FetchHelper({
FetchTemplate: ['<fetch version="1.0" output-format="xml-platform" mapping="logical">',
'<entity name="systemuser">',
'<attribute name="address1_country" />',
'<attribute name="orb_erpsystem" />',
'<filter>',
'<condition attribute="systemuserid" operator="eq" value="#{userid}"/>',
'</filter>',
'</entity>',
'</fetch>'].join("")
, GenerateSchemaName: false
}).ExecuteSync({userid: UserId });

$.when(fetch).then(function (response) {
//var results = response[0];
Orb_MSCRM60Condair.Salesorder.UserInformation.setAttribute("isFetched", true);
if (response.length > 0) {
res = response[0]; 
var orb_erpsytem = res["orb_erpsystem"];
if (orb_erpsytem) {
Orb_MSCRM60Condair.Salesorder.UserInformation.setAttribute("orb_erpsystem", orb_erpsytem);
}
}
else
{
Orb_MSCRM60Condair.Salesorder.fetchUserInformation();
}
});


JavaScript 2:

OrbUtils.FetchHelper = function(b) {
    debugger;
    var a = this;
    this.__metadata = "FetchHelper";
    this.FetchTemplate = b.FetchTemplate ? b.FetchTemplate : "";
    this.CallBack = b.CallBack;
    this.Map = b.Map;
    this.GenerateSchemaName = b.GenerateSchemaName != null ? b.GenerateSchemaName : true;
    this.EnableGridPaging = b.EnableGridPaging;
    if (this.EnableGridPaging == null) this.EnableGridPaging = true;
    this.EnableGridSorting = b.EnableGridSorting;
    if (this.EnableGridSorting == null) this.EnableGridSorting = true;
    this.EditGrid = b.EditGrid;
    if (typeof OrbEditGrid != "undefined" && this.EditGrid == null) this.EditGrid = OrbEditGrid;
    this.ContinuationDelegate = b.ContinuationDelegate;
    this.ErrorCallBack = b.ErrorCallBack;
    this._CallBack = function(c, b) {
        if (b.arguments != null) b = $.extend({}, b, b.arguments);
        var d = b;
        if (b != null)
            if (b.NavigationData != null) a.NavigationData = b.NavigationData;
            else if (b.arguments != null && b.arguments.NavigationData != null) a.NavigationData = b.arguments.NavigationData;
        var e = a.CallBack,
            f = a.Map;
        if (f != null) try {
            c = jQuery.map(c, f, d)
        } catch (g) {
          debugger;
            OrbUtils.Trace("Error in Fetch Map Function", g, OrbUtils.EnumTracingLevel.Error);
            alert("There was an error in the map function. Check the console for further informations")
        }
        if (e != null) try {
            e(c, d, b._startTimestamp)
        } catch (h) {
          debugger;
            OrbUtils.Trace("Error in Fetch Map Function", h, OrbUtils.EnumTracingLevel.Error);
            alert("There was an error in the callback function. Check the console for further informations")
        }
        this.Results = c;
        return c
    };
    this._internalCallBack = function(d, b, c) {
        if (b == null) b = {};
        var e = false;
        if (a.ContinuationDelegate != null) e = !a.ContinuationDelegate.call(a, b._startTimestamp);
        if (b != null) b.isCompleted = true;
        if (e == false) {
            c = a._CallBack(c, b);
            if (d && d._results == null) d._results = c
        }
    };
    this.getFetchString = function(a) {
        var b = this.FetchTemplate;
        if (typeof this.EditGrid != "undefined") {
            if (a == null) a = {};
            if (a._COUNT == null) a._COUNT = this.EditGrid.gridNavigation.NavigationInfo.PageInfo_GetPageSize();
            if (a._PAGE == null) a._PAGE = this.EditGrid.gridNavigation.NavigationInfo.PageInfo_GetPageCount();
            if (this.EditGrid.gridNavigation.FilterType == OrbTypes.EnumNavFilterType.server && this.EnableGridPaging == true) {
                if (b.indexOf(" count=") < 0) b = b.replace("<fetch ", '<fetch  count="' + a._COUNT.toString() + '" ');
                if (b.indexOf(" page=") < 0) b = b.replace("<fetch ", '<fetch  page="' + a._PAGE.toString() + '" ');
                if (b.indexOf("returntotalrecordcount") < 0) b = b.replace("<fetch ", '<fetch returntotalrecordcount = "true" ')
            }
            if (this.EditGrid.gridNavigation.FilterType == OrbTypes.EnumNavFilterType.server && this.EnableGridSorting == true) {
                var d = this.EditGrid.gridNavigation.GetAllFetchSortStrings();
                for (var c in d)
                    if (a[c] == null) a[c] = d[c]
            }
        }
        return (new OrbTemplate(b)).evaluate(a)
    };
    this.ExecuteSync = function(e, b) {
        var c = this.getFetchString(e);
        if (b == null) b = {};
        var d = OrbServices.CrmService.Fetch(c, false, null, null, b, this.GenerateSchemaName);
        return a._CallBack(d, b)
    };
    this.ExecuteAsync = function(e, c) {
        var d = this.getFetchString(e),
            b = c ? c : {};
        b._startTimestamp = (new Date).valueOf();
        var h = this._CallBack,
            g = this,
            f = OrbServices.CrmService.Fetch(d, false, function(c, b) {
                if (b && b.jqXHR) b.jqXHR._results = c;
                a._internalCallBack(b.jqXHR, b, c)
            }, null, b, a.GenerateSchemaName);
        return f
    }
};


Kindly help. thanks for your help in advance. High Priority

*This post is locked for comments

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: CRM Upgrade from 2013 to 2016 JavaScript error

    Hi,

    It appears that you are missing anther library altogether which contains OrbUtils.

  • Suggested answer
    Adrian Begovich Profile Picture
    1,019 Super User 2025 Season 1 on at
    RE: CRM Upgrade from 2013 to 2016 JavaScript error

    Hi Aldous Huxley,

    The script error message mentions that OrbUtils is undefined at Orb_MSCRM60Condair.Salesorder.fetchUserInformation();.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,865 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,723 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans