Monday, May 11, 2015

CIL generation error : The given key was not present in the dictionary.


Recently I faced this error when generating incremental IL
"CIL generation: The given key was not present in the dictionary."

The quick way to fix this is to check the CIL log file, generally located at "C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL\Dynamics.Ax.Application.dll.log"

Here you will find the AOT object for which the CIL generator found the error. Compile that object, fix the error and then regenerate the IL.

Before generating IL make sure that there are no compilation errors in the code.

Cheers!

Duplicate type with name 'Dynamics.Ax.application.' in assembly 'Dynamics.Ax.application,

To resolve this issue perform the following steps:

  1. Full compile AX
  2. Stop the AOS
  3. Truncate the SysXPPAssembly table in SQL (the table is used to contain the assemblies and to share between multiple AOS instances)
  4. Delete the DLL and netmodule files in your AOS's bin\xppIL directory(C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL directory).
  5. Restart the AOS
  6. Perform full CIL generation

Sunday, May 10, 2015

AIF value substitution maps



By creating value substitution mapping, you can define how values are replaced when data is processed in a pipeline. Each lookup table(substitution map) can act on only one data type. For example, for the ExternalItemId data type, you can create entries that replace several part numbers with part account numbers.

Goto System administration > Setup > Services and Application Integration Framework and open Value substitution maps.





Each entry in a lookup table defines a relationship between an internal value and an external value. The way that values are substituted depends on the direction of the document transfer.

For inbound transfers, the value that you enter in the Internal value field replaces the value that you enter in the External value field.
For outbound transfers, the value that you enter in the External value field replaces the value that you enter in the Internal value field.

Cheers! :)

Thursday, May 7, 2015

How to configure automatic shutdown for all online users

Go to Menu –> Tools –> Option as shown in the screen below.




Go to General -> Interface options -> Security and specify automatic shutdown time, screen shot below.





Wednesday, May 6, 2015

Bypass validation of DocumentHash when updating a record using AIF


Here is the code to bypass validation of DocumentHash when updating a record using AIF

docVersionXml = _axInternalBase.parm_DocumentHash();

if (docVersionXml)
{
docVersionDb = document.getRecordHash();

    if (docVersionDb != docVersionXml)
    {
throw error("@SYS106156");
    }
}
else
{
throw error(strfmt("@SYS26332", AxInternalBase::stripParm(methodstr(AxInternalBase, parm_DocumentHash))));
}

Enjoy!

Force Sync AOT tables through X++


Here is the code to force the database synchronization in Dynamics Ax,

static void forceSyncDB(Args _args)
{
Dictionary dict;
int idx, lastIdx, totalTables;
TableId tableId;
Application application;
SysOperationProgress progress;
StackBase errorStack;
ErrorTxt errorTxt;

application = new Application();
dict = new Dictionary();
totalTables = dict.tableCnt();
progress = new SysOperationProgress();
progress.setTotal(totalTables);
progress.setCaption(“@SYS90206″);
errorStack = new StackBase(Types::String);
lastIdx = 0;

try
{
for (idx = lastIdx+1; idx <= totalTables; idx++)
{
tableId = dict.tableCnt2Id(idx);
progress.setText(dict.tableName(tableId));
lastIdx = idx;
application.dbSynchronize(tableId, false, true, false);
progress.incCount();
}
}
catch (Exception::Error)
{
errorTxt = strFmt("Error in table '%1' (%2)", tableId, dict.tableName(tableId));
errorStack.push(errorTxt);
retry;
}

setPrefix("@SYS86407");
errorTxt = errorStack.pop();

while (errorTxt)
{
error(errorTxt);
errorTxt = errorStack.pop();
}
}

Cheers! 

Sunday, May 3, 2015

Deploy Microsoft Dynamics AX 2012 R3 on Azure

You can deploy Microsoft Dynamics AX 2012 R3 on MS Azure virtual machines. Refer to this TechNet link for more details.