We are releasing version 1.4 or our CRM JavaScript conversion tool, CRM Migration Assistant, today.
The trial version can be downloaded here.
Version 1.4 contains the following changes:
Fix: Two-byte characters improperly converted from a customization zip file
If you attempted to convert an exported customization file that contained two-byte characters, like an umlaut, that character would be converted to ‘??’. This has been corrected.
User Interface Additions
We’ve added a checkbox to allow you to permanently synchronize scrolling when reviewing the post-conversion JavaScript.
New Conversion Alerts:
Conversion alerts have been added for the following JavaScript methods or properties:
- ontop
- appendChild
- createElement
- innerHTML
- outerHTML
- replaceNode
- returnValue
- crmGrid
- document.all.help
- document.all.crmRenderStatus
- document.all.tdRelatedInformationPane
Improperly-Terminated JavaScript Conversion
Some developers, especially those that do not really understand JavaScript, have a habit of not terminating their JavaScript commands with a semi-colon. This can cause issues during the conversion process. We added extra checks to correct some issues seen during the conversion when an improperly-terminated command was encountered.
Navigation Item Visibility
If we encounter code that appears to hide or show a form’s navigation item, we will convert that code into the proper CRM 2011 equivalent. For example:
document.getElementById("navExistingProducts").style.display = "none";
Converts to:
Xrm.Page.ui.navigation.items.get("navExistingProducts").setVisible(false);
Expanded Conversion of .all properties
in certain cases the developer may have assigned the value of crmForm to a variable, which is referenced from that point forward. We have enhanced the conversion of such instances. For example:
if (parentForm.all.new_vaeid.DataValue != null) { var VAE = crmForm.all.new_vaeid; lookupData = new Array(); var lookupVAE = new Object(); lookupVAE.id = parentForm.all.new_vaeid.DataValue[0].id; lookupVAE.typename = 'new_vae'; lookupVAE.name = parentForm.all.new_vaeid.DataValue[0].name; lookupData[0] = lookupVAE; VAE.DataValue = lookupData; }
Converts to:
if (parentForm.getAttribute("new_vaeid").getValue() != null) { var VAE = Xrm.Page.getAttribute("new_vaeid"); lookupData = new Array(); var lookupVAE = new Object(); lookupVAE.id = parentForm.getAttribute("new_vaeid").getValue()[0].id; lookupVAE.typename = 'new_vae'; lookupVAE.name = parentForm.getAttribute("new_vaeid").getValue()[0].name; lookupData[0] = lookupVAE; VAE.setValue(lookupData); }
crmForm.all.item Conversion
JavaScript has a built-in iterator called .item, which is sometimes used by CRM JavaScript developers. We have added support for .item, which will be converted just as if it was crmForm.all. Examples:
var Iframe = crmForm.all.item(id); var optionSet = crmForm.all.item(new_country); crmForm.all.item("youRfield" + i + "blabla").style.display = 'none'; crmForm.all.item(fieldName + "_c").style.display = "none"; var type1id = crmForm.all.item("new_type1id").DataValue != null ? crmForm.all.item("new_type1id").DataValue[0].id : null; var defaultValue = crmForm.all.item(fieldName).DataValue; var textField = crmForm.all.item(fieldName); crmForm.all.item(fieldName).DataValue = "UK";
Converts to:
var Iframe = Xrm.Page.getAttribute(id); var optionSet = Xrm.Page.getAttribute(new_country); Xrm.Page.getAttribute("youRfield" + i + "blabla").setVisible(false); Xrm.Page.getAttribute(fieldName + "_c").setVisible(false); var type1id = Xrm.Page.getAttribute("new_type1id").getValue() != null ? Xrm.Page.getAttribute("new_type1id").getValue()[0].id : null; var defaultValue = Xrm.Page.getAttribute(fieldName).getValue(); var textField = Xrm.Page.getAttribute(fieldName); Xrm.Page.getAttribute(fieldName).setValue("UK");
.Refresh
.Refresh is now converted to .refresh.
‘text/javascript’ and ‘stylesheet’ Identification
Added a check for the literals: ‘text/javascript’ and ‘stylesheet’ which can be used to indicate external files where the developer may be adding external JavaScript or CSS files.
Tab Visibility
Setting a Tab’s visibility will be converted to the correct CRM 2011 method. For example:
tabXTab.style.display = 'none';
Converts to:
Xrm.Page.ui.tabs.get(X).setVisible(false);