Hi,
I am getting an following error in JavaScript 1 which refers to JavaScript 2 function.
Error:
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