/ Microsoft / Automatic role assignment and named user license count reports processing batch job

Automatic role assignment and named user license count reports processing batch job

Learn, share and spread knowledge

Batch jobs are very useful to do recurring and back end jobs to achieve the requirements. Different batch jobs are written for different purposes. There are two standard Batch Jobs in Dynamics AX that are as follows:

  1. Automatic role assignment batch job – it assign roles to users as per the defined rules every hour
  2. Named user license count reports processing batch job – it counts the users count per license type

Sometimes, these two batch jobs are missed in the Batch job form in Systems Administration. I have been victim of this and after finding out the reason why these jobs are missing from the form Batch job, I came across the solution which I have applied in Microsoft Dynamics AX 2012, and the problem was solved.

There are many reason for their disappearance. The reasons are as follows:

  1. Named user license count reports processing batch job is partition independent. The form batch job is filtered to show the current partitions’ batch jobs. Normally this job is created in the Initial partition.
  2. Automatic role assignment batch job is created in initial partition and then more partitions are added, it will not be created to run periodically after completion of Partition Initialization Checklist.
  3. Automatic role assignment and Name user license count reports processing batch jobs are deleted from the list.

Solutions:

It is not possible to add the batch jobs manually in the list again. To solve this problem, you can run a checklist and start the Synchronize task, but this will be time consuming.

The other workaround is that we will comment a line in the default class of Dynamics AX 2012 i.e. SysSecurityDynamicRoleAssignment class. And then we will create a job and run it. See the steps as follows:

    1. Go to SysSecurityDynamicRoleAssignment class
    2. Go to createBatchJob function
    3. Find out the below code in createBatchJob function:
      select firstonly BatchJobId from batch where batch.ClassNumber == classNum(SysSecurityDynamicRoleAssignment) && batch.CreatedBy == curUserId() && batch.DataPartition == getcurrentpartition();
    1. Comment the condition after &&
    1. Run the below job:
      //Author:   Moeen Ahmed Sultan
      //Email:    moeenahmedsultan@hotmail.com
      //Tel:      +92 321 458 9595
      
      //Go to SysSecurityDynamicRoleAssignment class
      //Go to createBatchJob function
      //Find out the below code
      //select firstonly BatchJobId from batch where batch.ClassNumber == classNum(SysSecurityDynamicRoleAssignment) &&
      //      batch.CreatedBy == curUserId() && batch.DataPartition == getcurrentpartition();
      //Comment the condition after &&
      //Run the CreateStandardBatchJobs job
      //Revert/uncomment the commented code
      
      static void CreateStandardBatchJobs(Args _args)
      {
          SysSecurityDynamicRoleAssignment::createBatchJob();
          SysUserLicenseMiner::createBatchJob();
          info("Standard batch jobs created successfully.");
      }
  1. Revert/uncomment the commented code

The two standard batch jobs will be inserted in the Batch table again and will be shown in the form Batch jobs again.

If you find better solution or any ambiguity in the article. Please comment!

GitHub: Click here

It does not matter how slowly you go as long as you do not stop. – Confucius

1 POST COMMENT

Send Us A Message Here

Your email address will not be published. Required fields are marked *

1 Comments