The DirPartyLocation::findByPartyLocationRole method is obsolete. Deprecated for performance.

Use¬†DirPartyLocation::findByPartyLocationRoleType instead ūüôā

Advertisements

AOTfirstChild() doesn’t work on project

This code doesn’t print yes:

ProjectNode projectNode = SysTreeNode::getSharedProject().AOTfindChild('new');
 projectnode = projectNode.AOTfirstChild();
 if (projectNode)
 info ('yes');

This Does:

ProjectNode projectNode = SysTreeNode::getSharedProject().AOTfindChild('new');
 projectNode = projectNode.loadForInspection();
 projectnode = projectNode.AOTfirstChild();
 if (projectNode)
 info ('yes');

Use loadForInspection to get inside a AOT project.

Blank error starting AX 2012 R3.

What to do when you open AX R3 CU9 and see this beauty. Empty error description.

Captureblank

The issue appeared due to difference in AX versions that were used for database (R3 CU10), and AOS (R3 CU8) .

Solution for this problem is to renew an AOS and client

You can ensure that you have the issue by finding issue description in the event viewer:

Object Server 01:  Fatal SQL condition during login. Error message: "The internal time zone version number stored in the database is higher than the version supported by the kernel (9/8). Use a newer Microsoft Dynamics AX kernel."

Turn off CIL exectution for user from code in AX 2012

If you cannot open the user options from AX 2012 for some reason, but you have to uncheck “Execute Buisness operations in CIL” you can use this job :

static void SR_CreateProjects_subProjects(Args _args)
{
    #LOCALMACRO.FLAG_ExecBusinessOpsWithInterpreter (1 << 10) #ENDMACRO
     UserInfo userinfo;
     ttsBegin;
         select forUpdate userinfo where userinfo.id == 'Admin';
         userInfo.DebugInfo = userInfo.DebugInfo | #FLAG_ExecBusinessOpsWithInterpreter;
         userinfo.update();
     ttsCommit;
}

How to know if the layer was modified? Ax 2012

To check if the layer was modified you can iterate all  records in sysModelLayer table and check if object(each record represents an object) is modified on the required layer. That can be done using this code:

static void Working(Args _args)
{
 SysModelLayer layers;
    while select * from layers where layers.VersionNumber > 0
    { 
        info(strFmt("%1",layers.Layer));
    }
}