Migration to CRM 2016: Unable to get property 'getPageData' of undefined or null reference - dynamics-crm-2016

After migration from CRM 2013 to CRM 2016 (On Premise), we have error messages in the browser like:
Unable to get property 'getPageData' of undefined or null reference
Unable to get property 'className' of undefined or null reference
Unable to get property 'firstChild' of undefined or null reference
The error happens in components of CRM. Any idea, what the reason could be?
<ReportVersion>1.0</ReportVersion>
<ScriptErrorDetails>
<Message>Unable to get property 'getPageData' of undefined or null reference</Message>
<Line>2083</Line>
<URL>/_static/form/formcontrols.js?ver=1804820318</URL>
<PageURL>/form/page.aspx?lcid=1033&themeId=f499443d-2082-4938-8842-e7ee62de9a23&tstamp=197130723&updateTimeStamp=635905304768102438&userts=131002784247688030&ver=1804820318#etc=2&extraqs=%3fetc%3d2%26id%3d%257b7DE4DCC6-207F-E511-9528-005056A03927%257d&pagemode=iframe&pagetype=entityrecord&counter=1455804831411</PageURL>
<Function>anonymousr:Unabletogetproperty'getPageData'ofundefinedornullreference</Function>
<FunctionRaw>TypeError: Unable to get property 'getPageData' of undefined or null reference</FunctionRaw>
<CallStack>
<Function>anonymousr:Unabletogetproperty'getPageData'ofundefinedornullreference</Function>
</CallStack>
</ScriptErrorDetails>

Try suggestion provided at the end of thread - https://community.dynamics.com/crm/f/117/p/190275/482107
When do errors occur?

I' v had similar error [1] on 8.2.2.112 when pressing Next Stage on Business Process Flow. Much effort was put into debugging so wanted to document it somwhere.
Rollup field
The error was caused by rollup fields that provides SUM for Money fields. The HTML generated by CRM and javascript function didn't match.
Guilty line is within /_static/form/formcontrols.js called on line 28871:
XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetNextSibling(this.get_controlValue().parentNode)))))).innerHTML = CrmEncodeDecode.CrmHtmlDecode((this.$5_1.$3_2).get_currencySymbol());
This one returns null and it therefore spits error: XUI.Html.DomUtils.GetNextSibling(this.get_controlValue().parentNode
Solution
FIX 1: Enable "Use legacy form rendering" under System Settings
OR Fix 2: Remove Currency rollup fields from form.
OR Fix 3: Create non-rollup fields that get calculated with workflow or plugin.
OR Fix 4: You may do some jQuery stuff and add some empty siblings which it -
expects. Except it may show duplicate currency symbol (at least for EUR currency) - one as prefix the other one as suffix.
OR Fix 5: Most undesirable way: patch that .js yourself if you're on-premises.
Replace line 28871:
XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetNextSibling(this.get_controlValue().parentNode)))))).innerHTML = CrmEncodeDecode.CrmHtmlDecode((this.$5_1.$3_2).get_currencySymbol());
With:
if (XUI.Html.DomUtils.GetNextSibling(this.get_controlValue().parentNode) !== null) {
XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetNextSibling(this.get_controlValue().parentNode)))))).innerHTML = CrmEncodeDecode.CrmHtmlDecode((this.$5_1.$3_2).get_currencySymbol());
}
[1] Error:
<ScriptErrorDetails>
<Message>Cannot read property 'firstChild' of null</Message>
<Line>0</Line>
<URL>/form/page.aspx?lcid=1033&themeId=2cf54f8a-be4d-477c-a1f5-29b894a487ca&tstamp=53798526&updateTimeStamp=636392540341784672&userts=131546192871874626&ver=-1991520363#etc=3&extraqs=%3f_gridType%3d3%26etc%3d3%26id%3d%257b586C2C21-E8F8-E611-80F5-005056BD19EE%257d%26opened%3dgrid%26process%3dc9426a91-9fc0-4c2d-a21c-4b9d2a38a6d5%26processts%3d51389819%26rskey%3d%257b00000000-0000-0000-00AA-000010003001%257d&pagemode=iframe&pagetype=entityrecord&rskey=%7b00000000-0000-0000-00AA-000010003001%7d&counter=1510145890205</URL>
<PageURL>/form/page.aspx?lcid=1033&themeId=2cf54f8a-be4d-477c-a1f5-29b894a487ca&tstamp=53798526&updateTimeStamp=636392540341784672&userts=131546192871874626&ver=-1991520363#etc=3&extraqs=%3f_gridType%3d3%26etc%3d3%26id%3d%257b586C2C21-E8F8-E611-80F5-005056BD19EE%257d%26opened%3dgrid%26process%3dc9426a91-9fc0-4c2d-a21c-4b9d2a38a6d5%26processts%3d51389819%26rskey%3d%257b00000000-0000-0000-00AA-000010003001%257d&pagemode=iframe&pagetype=entityrecord&rskey=%7b00000000-0000-0000-00AA-000010003001%7d&counter=1510145890205</PageURL>
<Function>anonymous(dirtyVisiblePropertyData){var$v_0=dirtyVisiblePropertyData.getKeys();for(var$v_1=0;$v_1<$v_0.length;$v_1++){var$v_2=$v_0[$v_1];if(IsNull(this.get_viewMap().get_item($v_2))){}else{try{this.get_viewMap().get_item($v_2).update(dirtyVisiblePropertyD</Function>
<FunctionRaw>function (dirtyVisiblePropertyData) {
var $v_0 = dirtyVisiblePropertyData.getKeys();
for (var $v_1 = 0; $v_1 < $v_0.length; $v_1++) {
var $v_2 = $v_0[$v_1];
if (IsNull(this.get_viewMap().get_item($v_2))) {
</FunctionRaw>
<CallStack>
<Function>anonymous(dirtyVisiblePropertyData){var$v_0=dirtyVisiblePropertyData.getKeys();for(var$v_1=0;$v_1<$v_0.length;$v_1++){var$v_2=$v_0[$v_1];if(IsNull(this.get_viewMap().get_item($v_2))){}else{try{this.get_viewMap().get_item($v_2).update(dirtyVisiblePropertyData.get_item($v_2));}catch($v_3){Mscrm.CrmDebug.fail(String.format('ExceptionencounteredupdatingUIelement{0}:{1}',$v_2,$v_3.message));catchError($v_3.message,window.location.href,0,true);}}}}</Function>
<Function>anonymous(){if(this.$AV_1){var$v_0=this.$4h_1;this.$4h_1=new(Mscrm.TurboForm.Control.TypedDictionary$1.$$(Mscrm.TurboForm.Control.PropertyBag))();this.ui.updateUI($v_0);}}</Function>
<Function>anonymous(){this.$7A_1++;var$v_0=null;if(!this.$AE_1){setPerformanceMarkerTimestamp(String.format('UIUpdate{0}StartTime',this.$7A_1));$v_0=Xrm.Internal.startMetricsStopwatch(String.format('UIUpdate{0}',this.$7A_1));$v_0.start();}this.$8w_1=false;for(var$v_1=0;$v_1<this.$2F_1.length;$v_1++){var$v_2=this.$2F_1[$v_1];if(!IsNull($v_2)){$v_2.flushVisibilityChanges();}}if($v_0){$v_0.stop();setPerformanceMarkerTimestamp(String.format('UIUpdate{0}EndTime',this.$7A_1));}window.top.TurboFormLoadStartTime=null;}</Function>
<Function>anonymous(){Mscrm.Performance.PerformanceMarkerManager.get_instance().addMarker('MDDEnd',1);try{var$v_0=Xrm.Internal.startMetricsStopwatch('PostOnLoadUIUpdate');$v_0.start();this.finishUIUpdate();$v_0.stop();}finally{this.$Ih_1();this.updateFormDirtyState();try{if(isOutlookHostedWindow()){getOutlookHostedWindow().handlePostOnLoad();}}catch($$e_1){}}}</Function>
<Function>anonymous(){var$v_0=Xrm.Internal.startMetricsStopwatch('HandlePostOnLoad');$v_0.start();if(Mscrm.TurboForm.Control.PageManager.get_instance().$L_1===this){this.get_pidRequestManager().clearRecords();Mscrm.TurboForm.Control.PageManager.get_instance().handlePostOnLoad();var$v_1=Mscrm.TurboForm.Control.PageBootstrapper.getPageState();if(!IsNull($v_1)&&$v_1.formType!==7&&!$v_1.recordId.equals(Microsoft.Crm.Client.Core.Framework.Guid.get_empty())){Mscrm.TurboForm.Control.PageBootstrapper.requestSubGridData();}this.get_pidRequestManager().requestPidPtsWithLookupService();setAttributeInWindow('FormEntityLogicalName',(this.data.getEntity())?this.data.getEntity().getEntityName()||'':'');setAttributeInWindow('FormEntityTypeCode',(this.data.getEntity()&&!Mscrm.InternalUtilities.JSTypes.isNull(this.data.getEntity().getEntityTypeCode()))?this.data.getEntity().getEntityTypeCode().toString():'');if(!Mscrm.InternalUtilities.JSTypes.isNullOrEmptyString(window.CUSTOM_ETC_LIST)&&JSON.parse(window.CUSTOM_ETC_LIST).indexOf(this.data.getEntity().getEntityTypeCode())>-1){setAttributeInWindow('IsCustomEntity','true');}else{setAttributeInWindow('IsCustomEntity','false');}if(!IsNull(window.turboHeaderScriptIncludes)){if(this.scriptIncludesSearch(window.turboHeaderScriptIncludes,'/_static/cs/articlesearchribbon/articlesearchribbon.js')){Mscrm.CrmHeader.setScriptFileForTurboForm(Mscrm.CrmUri.create('/_static/CS/ArticleSearchRibbon/ArticleSearchRibbon.js'));}}Mscrm.TurboForm.Control.PageManager.get_instance().loadActionHubIframe();window.setTimeout(this.$$d_$Ff_1,15);if(!IsNull($v_1)&&$v_1.formType!==7){Mscrm.MetricsCollector.collectAndReportClientMetrics(2);}}else{Mscrm.TurboForm.Control.PageManager.get_instance().finishUIUpdate();}$v_0.stop();}</Function>
<Function>anonymous(){returnb.apply(a,arguments)}</Function>
<Function>anonymous(c,d){for(varb=0,e=a.length;b<e;b++)a[b](c,d)}</Function>
<Function>anonymous(message){switch(message){case'TurboFormPostOnloadTimestamp':setPerformanceMarkerTimestamp('TurboFormPostOnloadTimestamp');Mscrm.Performance.PerformanceMarkerManager.get_instance().addMarker('TurboFormPostOnloadTimestamp',1);var$v_0=Mscrm.TurboForm.Control.CustomScriptsManager.get_instance().$7d_1.getHandler(String.format('MessageEventFormat_{0}',message));if(!IsNull($v_0)){$v_0();window.pageLoadedCheckForNavigateApi=true;if(!IsNull(window.parent)&&!IsNull(window.parent.parent)){window.parent.pageLoadedCheckForNavigateApi=true;window.parent.parent.pageLoadedCheckForNavigateApi=true;}}break;case'ScriptsAreLoaded':if(Mscrm.TurboForm.Control.CustomScriptsManager.get_instance().$57_1){Mscrm.TurboForm.Control.CustomScriptsManager.get_instance().$57_1=false;}var$v_1=Mscrm.TurboForm.Control.CustomScriptsManager.get_instance().$7d_1.getHandler(String.format('ScriptsAreLoaded',message));if(!IsNull($v_1)){$v_1();}break;}}</Function>
<Function>SendMessageToPageManager(message)</Function>
<Function>RunHandlerInternal(method,parameters,executionContext,executeIfAvailableOnly)</Function>
<Function>RunHandlers()</Function>
<Function>OnScriptTagLoaded(url)</Function>
<Function>anonymous(){OnScriptTagLoaded(url);}</Function>
</CallStack>
</ScriptErrorDetails>

Thanks to Andrii!
Removing a composite control in the header did the trick.
It seems to be a bug in CRM 2016, but our customers can live without this information in the header. All fine!
Kind regards,
Matthias

Related

CKEDITOR4 Mentions Plugin with ajax : javascript error

I have a javascript error using CKEDITOR 4 and the Mentions Plugin.
I can't solve this problem for 2 days, I'm stuck.
I've used the online builder to get CKEDITOR + Mentions plugin.
See my build here: https://ckeditor.com/cke4/builder/fbe187b32ec7c025e28e01a537c72c62
With the following configuration it works fine: I see the drop down list with the names : Anna, Thomas, John
CKEDITOR.config.mentions = [{feed: ['Anna', 'Thomas', 'John']}];
However, when doing an ajax call to get the data, I got a javascript error:
The script /ajax_mention.php
displays
["Anna", "Thomas", "John"]
with the following configuration :
CKEDITOR.config.mentions = [{feed: '/ajax_mention.php'}];
when I type in the editor "#anna", the names do not display
the /ajax_mention.php script is launched and displays the correct data (when I look at the "network" tab on Chrome. see screenshot)
["Anna", "Thomas", "John"]
However, this triggers a javascript error (looking at the Chrome console tab. see screenshot)
ckeditor.js?1645882460:916 Uncaught TypeError: Cannot read properties of null (reading 'addClass')
at g.selectItem (ckeditor.js?1645882460:916:473)
at d.onSelectedItemId (ckeditor.js?1645882460:912:276)
at f.q (ckeditor.js?1645882460:10:246)
at f.fire (ckeditor.js?1645882460:12:91)
at f.select (ckeditor.js?1645882460:920:294)
at f.selectFirst (ckeditor.js?1645882460:920:371)
at d.open (ckeditor.js?1645882460:910:503)
at d.modelChangeListener (ckeditor.js?1645882460:911:234)
at f.q (ckeditor.js?1645882460:10:246)
at f.fire (ckeditor.js?1645882460:12:91)
See screen copy:
https://polyglotclub.com/bug_ckeditor_mentions.jpg
screen copy
The solution was given by the Ckeditor team : see https://github.com/ckeditor/ckeditor4/issues/5107
When we use a hardcoded data in the array, such as ['Anna, 'Geralt'] the createArrayFeed() function changes the input structure from the mentioned above to:
[
{
id: 1,
name: 'Anna'
},
{
id: 2,
name: 'Geralt'
}
]
I've just adjusted data on the backend side to the structure above.

Service Now : transform map stopped due to error: java.lang.NumberFormatException

The transform is getting aborted but only if I marked the checkbox copy empty fields and also the rest of the entry of the Import set is getting stuck at pending, also I verified the transform script but no luck.
Below is the error :
Import set: ISETxxxxxxx transform stopped due to error: java.lang.NumberFormatException
java.lang.NumberFormatException
at java.math.BigDecimal.<init>(BigDecimal.java:596)
at java.math.BigDecimal.<init>(BigDecimal.java:383)
at java.math.BigDecimal.<init>(BigDecimal.java:806)
at com.glide.script.glide_elements.GlideNumber.getSafeBigDecimal(GlideNumber.java:42)
at com.glide.currency.GlideElementCurrency.coerceAmount(GlideElementCurrency.java:406)
at com.glide.currency.GlideElementCurrency.cleanAmount(GlideElementCurrency.java:389)
at com.glide.currency.GlideElementCurrency.setDisplayValue(GlideElementCurrency.java:136)
at com.glide.currency.GlideElementCurrency.setValue(GlideElementCurrency.java:89)
at com.glide.db.impex.transformer.TransformerField.copyEmptyFields(TransformerField.java:202)
at com.glide.db.impex.transformer.TransformerField.setValue(TransformerField.java:130)
at com.glide.db.impex.transformer.TransformerField.transformField(TransformerField.java:84)
at com.glide.db.impex.transformer.TransformRow.transformCurrent(TransformRow.java:100)
at com.glide.db.impex.transformer.TransformRow.transform(TransformRow.java:69)
at com.glide.db.impex.transformer.Transformer.transformBatch(Transformer.java:150)
at com.glide.db.impex.transformer.Transformer.transform(Transformer.java:76)
at com.glide.system_import_set.ImportSetTransformerImpl.transformEach(ImportSetTransformerImpl.java:239)
at com.glide.system_import_set.ImportSetTransformerImpl.transformAllMaps(ImportSetTransformerImpl.java:91)
at com.glide.system_import_set.ImportSetTransformer.transformAllMaps(ImportSetTransformer.java:64)
at com.glide.system_import_set.ImportSetTransformer.transformAllMaps(ImportSetTransformer.java:50)
at com.snc.automation.ScheduledImportSetJob.runImport(ScheduledImportSetJob.java:55)
at com.snc.automation.ScheduledImportJob.execute(ScheduledImportJob.java:45)
at com.glide.schedule.JobExecutor.execute(JobExecutor.java:83)
at com.glide.schedule.GlideScheduleWorker.executeJob(GlideScheduleWorker.java:207)
at com.glide.schedule.GlideScheduleWorker.process(GlideScheduleWorker.java:145)
at com.glide.schedule.GlideScheduleWorker.run(GlideScheduleWorker.java:62)
I'm guessing you have a field that required that is a decimal or similar.
The error java.lang.NumberFormatException indicates it's failing to convert an empty string to 0.0.
Use a source script line to convert this, something along the lines of this
answer = (function transformEntry(source) {
if (source.u_number_field.nil())
return 0.0;
})(source);

XML Parsing Error : AJAX Chat

I am just trying to plant AJAX Chat for my website users. I have successfully completed the installation process with database configuration. But when I am trying to brows the domain.com/ajaxchat/index.php its returning this error given below:
XML Parsing Error: junk after document element Location: http://futurenext.esy.es/inc/chat/ Line Number 2, Column 1:
I think that the problem is in AJAXChatTemplate.php , and here the code is:
function getContent() {
if(!$this->_content) {
$this->_content = AJAXChatFileSystem::getFileContents($this->_templateFile);
}
return $this->_content;
And the error message is like:
" Non-static method AJAXChatFileSystem::getFileContents() should not be called statically, assuming $this from incompatible context in line 37"
Now please any one can help me to fix the problem. What is the problem here I can't really understand. Thanks.

Acceleo java wrapping service doesn't take complex parameter - Invalid result for expression self.invoke

I can't call a java wrapping service in Acceleo because it doesn't recognize parameters type. This is my simple test code: the main calls a query stored in Services.mtl, that calls the java service that just return the name of an object "Send"
Main.mtl
[file ('system.P', false, 'UTF-8')]
[for (t : Send | aSystemBehavior.transitions)) ]
[getName(t)/]
[/for]
[/file]
Services.mtl
[query public getName(arg0 : Send) : String
= invoke('myPackage.Services', 'getName(myPackage.Send)', Sequence{arg0})
/]
Services.java
public class Services
{
public String getName(Send t)
{return t.getName();}
}
The Error Log shows:
Invalid result for expression
self.invoke('myPakage.Services',
'getName(myPakage.Send)', Sequence {arg0}) at line 0 in
Module services for query getName(Send). Last recorded value of self
was org.eclipse.emf.ecore.impl.DynamicEObjectImpl#1f00eb36 (eClass:
org.eclipse.emf.ecore.impl.EClassImpl#2c2aade3 (name: Send)
(instanceClassName: null) (abstract: false, interface: false)).
Problem found while generating the file system.P'.
If I use a String as parameter type instead of Send, everything works fine.
Does the package containing the service "Services" has been exported? If not, open the file MANIFEST.MF, go in the runtime tab and add its package to the list of exported packages. Are you sure that your "Send" object has a name? This message only indicates that null was returned by the query getName.
I don't have anymore this problem... I created a new Acceleo project from scratch, and it works. I am not sure what was the problem... maybe it's something about che choice of metamodels to import during the creation of the Module (I have to choose between run-tim and develop-time metamodel).

Docpad: confused about extending template data

I'm totally confused about adding mongo data to template data. I haven't even started trying to get the data from a database as I can't get my templates to see test data (see below). This is in docpad.coffee for the moment, but ultimately g will be the output of mongoDB.
events:
extendTemplateData: (opts) ->
# {templateData} = opts
getGigsData: ->
g = { "date" : "3-4-2013", "location" : "Gent" }
return g
opts.templateData["getGigsData"] = getGigsData
And I hope to access it with <%= #getGigsData().date %>
Thanks so much for some guidance
I should add that this design is based on wanting to make it easy for the band to add gigs, without letting them edit the page content itself as I fear they would mess up the markup - if there are other ways to achieve this goal, I'd be pleased to hear.
Tried this locally. And hit the issue:
debug: Emitting the event: extendTemplateData
→ [2014-02-14 01:38:50.030] [/Users/balupton/Projects/docpad-extras/skeletons/so-21747504/node_modules/docpad/out/lib/docpad.js:1184] [DocPad.emitSerial]
error: Something went wrong with the action
→ [2014-02-14 01:38:50.037] [/Users/balupton/Projects/docpad-extras/skeletons/so-21747504/node_modules/docpad/out/lib/interfaces/console.js:107] [ConsoleInterface.destroyWithError]
error: An error occured:
ReferenceError: getGigsData is not defined
at Object.docpadConfig.events.extendTemplateData (/Users/balupton/Projects/docpad-extras/skeletons/so-21747504/docpad.coffee:42:44)
at ambi (/Users/balupton/Projects/docpad-extras/skeletons/so-21747504/node_modules/docpad/node_modules/ambi/out/lib/ambi.js:25:27)
at DocPad.<anonymous> (/Users/balupton/Projects/docpad-extras/skeletons/so-21747504/node_modules/docpad/out/lib/docpad.js:995:25)
at ambi (/Users/balupton/Projects/docpad-extras/skeletons/so-21747504/node_modules/docpad/node_modules/ambi/out/lib/ambi.js:23:18)
at Task.<anonymous> (/Users/balupton/Projects/docpad-extras/skeletons/so-21747504/node_modules/docpad/node_modules/event-emitter-grouped/out/lib/event-emitter-grouped.js:45:23)
at ambi (/Users/balupton/Projects/docpad-extras/skeletons/so-21747504/node_modules/docpad/node_modules/ambi/out/lib/ambi.js:23:18)
at fire (/Users/balupton/Projects/docpad-extras/skeletons/so-21747504/node_modules/docpad/node_modules/taskgroup/out/lib/taskgroup.js:163:25)
at b (domain.js:183:18)
at Domain.run (domain.js:123:23)
at Task.fire (/Users/balupton/Projects/docpad-extras/skeletons/so-21747504/node_modules/docpad/node_modules/taskgroup/out/lib/taskgroup.js:173:25)
at processImmediate [as _immediateCallback] (timers.js:330:15)
Which indicates that the error is actually inside our event handler, rather than inside our code. That for some reason getGigsData is not being set, despite our:
getGigsData: ->
g = { "date" : "3-4-2013", "location" : "Gent" }
return g
Examining the code, as a CoffeeScript user, I found the issue. As a non-coffeescript user, you can use the coffeescript compiler on the coffeescript website http://coffeescript.org to see the compiled javascript, which is:
({
events: {
extendTemplateData: function(opts) {
({
getGigsData: function() {
var g;
g = {
"date": "3-4-2013",
"location": "Gent"
};
return g;
}
});
return opts.templateData["getGigsData"] = getGigsData;
}
}
});
As we can see that is definitely not what we expected. We are just defining getGigsData inside an object, then doing nothing with it.
The issue is that we used a colon instead of an equals sign, so getGigsData: -> instead of getGigsData = ->. This is not a coffeescript thing, but you would have run into the same issue if this was javascript too, albeit javascript may be a bit more obvious due to the necessary squiggly braces around object definitions.
As a sidenote, if you prefer to use JavaScript with DocPad for whatever reason, that is totally supported. You could use a docpad.json or docpad.js file for your docpad configuration file. Another option, is to continue using CoffeeScript then just wrap JavaScript code within the backtick, see: http://coffeescript.org/#embedded

Resources