AX 2009 Hotfix installation fails if it contains labels in “disabled” languages

When applying an application hotfix to an AX 2009 SP1 RU8 system, the “DynamicsSetupLog.txt” file reports:

An error occurred during setup of Application files.
 See C:\ProgramData\Microsoft\Dynamics AX\Dynamics AX Setup Logs\[date time]\KB[number]-SYP-SYP.log for additional informational messages.

The “KB[number]-SYP-SYP.log” file contains and error where “The value “ar” is not found in the map”:

<DynamicsAxAutoRun>
 <Info>Log file enabled: C:\ProgramData\Microsoft\Dynamics AX\Dynamics AX Setup Logs\[date time]\KB[number]-SYP-SYPImportLabels.log</Info>
 <Info>XML input file version: </Info>
 <Info>Release version: 5.0</Info>
 <Info>Launching command: Run</Info>
 <Run>
 <Info>Class name: SysHotfixManifest - Method: importLabels</Info>
 <Error>An error occurred when executing command: Run</Error>
 </Run>
 <Infolog>
 The value "ar" is not found in the map.
 </Infolog>
 </DynamicsAxAutoRun>

This is due to one or more languages being “disabled” for labels in the system (the “LabelFile” field in “LanguageTable” has the value 0).

The quick and easy workaround is to disable the import of labels in the “importLabels” method of the “SysHotfixManifest” class:

importElements.parmImportLabels(truefalse);

An alternative option is to use the suggested workaround in SysImportElements_Workaround.

The code changes in the “Class_SysImportElements_Workaround.xpo” file address the problem when importing xpo-files or hotfixes that contain labels for languages that aren’t set up for labels in the system. The default (that most will want to use) is to simply omit languages other than those marked with “LabelFile” in “LanguageTable” – if importing all languages in the KB is required, there’s an option to set the “addAllLabelLanguages” variable to “true” in “SysImportElements.new” (this will “enable” all the hotfix languages in the “LanguageTable”):

#    //  Workaround Should all label languages during an import be set as label languages in LanguageTable?
#    //addAllLabelLanguages    = true;

Additionally, the “Class_SysLabelEdit_Workaround.xpo” file contains a modification in “SysLabelEdit.findEqualLabelSet” that addresses an error that occurs when there is a “leading space” in the comment of a label that already exists in the system.

Disclaimer for code suggestions/workaround suggestions:

"Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. This mail message assumes that you are familiar with the programming language that is being demonstrated and the tools that are used to create and debug procedures."