users

Troubleshooting batch jobs in AX

If your batch jobs are seemingly not executing in Microsoft Dynamics AX, there could be a multitude of reasons. This guide will help with troubleshooting batch jobs in AX by listing the possible causes and providing solutions for each points.

Initial setup

It is important to define what is a batch job first:

A batch job is a process which will carry out specific tasks at a certain date and time running as a background process within the AX Application Object Server service.

We need to tell the system what is the process that we want execute, which consists of a Batch job as a header, and at least one Batch task which is the actual processes running. The batch jobs can be grouped together by their roles with the help of a Batch group. If none is provided, it would still classify as one called the “Empty batch group”.

(more…)

By |2017-09-25T19:51:42+02:00July 2nd, 2017|Categories: AX 2012|Tags: , , , , , |1 Comment

Default AX model for all users

If you want to set the default AX model for all of your active user accounts on a certain layer, you may run the following job to do so.

Whenever a new developer joins in, you may include running this job in your account creation process to make sure they do not try to check in code to the wrong place, but only to your correct default AX model.

Do not forget to change the layer and the name of the model.

static void WIK_UpdateDefaultModel(Args _args)
{
    UserInfo                userInfo;
    UserInfoStartupModel    userInfoStartupModel;
    UserInfoStartupModel    userInfoStartupModelDB;
    UtilEntryLevel          layer = UtilEntryLevel::cus;
    ModelId                 modelId = any2int((select firstOnly Model from SysModelManifest where SysModelManifest.Name == 'MyModel').Model);

    ttsBegin;

    while select userInfo
        where userInfo.accountType  == UserAccountType::ADUser
        notexists join userInfoStartupModel
            where  userInfoStartupModel.UserId  == userInfo.id
                && userInfoStartupModel.Layer   == layer
                && userInfoStartupModel.ModelId == modelId
    {
        userInfoStartupModelDB.clear();
        userInfoStartupModelDB.initValue();
        userInfoStartupModelDB.Layer            = layer;
        userInfoStartupModelDB.UserId           = userInfo.id;
        userInfoStartupModelDB.ModelId          = modelId;
        
        try
        {
            if (userInfoStartupModelDB.validateWrite())
            {
                userInfoStartupModelDB.insert();
            }
            else
            {
                throw error('We have a problem');
            }
        }
        catch
        {
            exceptionTextFallThrough();
        }
    }

    update_recordset userInfoStartupModel
        setting ModelId = modelId
        where userInfoStartupModel.Layer    == layer;

    ttsCommit;
}

MSDN link for UserInfoStartupModel: https://msdn.microsoft.com/en-us/library/userinfostartupmodel.aspx

By |2015-12-22T14:47:21+01:00December 22nd, 2015|Categories: AX 2012|Tags: , , , , |1 Comment

CIL execution to be disabled for all AX users

Recently we have faced an error during SSRS report printouts, where the quick fix was to temporarily disable CIL execution for all regular AX user accounts.

The error message was as per below, and this MSDN blog post has pointed us in the right direction of resolving the problem:

Failed to create a session; confirm that the user has the proper privileges to log on to Microsoft Dynamics.

The following job can be used to disable CLR operations. It essentially changes the Execute business operations in CIL setting under Options > Development tab based on the flag defined:

(more…)

By |2015-11-23T17:36:22+01:00November 23rd, 2015|Categories: AX 2012|Tags: , , , , |0 Comments
Go to Top