web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
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

I have the same question (0)
  • Suggested answer
    Adrian Begovich Profile Picture
    1,032 Moderator on at

    Hi Aldous Huxley,

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

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

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

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans