Import Ledger transactions/balances using Excel Add-in – AX 2012

Purpose:The purpose of this document is to illustrate how to use Microsoft Dynamics AX 2012 Excel Add-in for import of ledger transactions.
Challenge: Data model changes in Microsoft Dynamics related to high normalization and introduction of surrogate keys made some imports more complex. In fact the data model forming General Journal was not dramatically changed and import principle remains the same – populate the journal and then post the journal. However some information which is usually automatically generated in Microsoft Dynamics AX 2012 Rich Client by means of number sequences such as voucher number will have to be provided.
Solution: Microsoft Dynamics AX 2012 ships with General Journal AIF Web Service (LedgerGeneralJournalService) which can be used in integration scenarios. Also General Journal AIF Web Service can be used in Excel for import of ledger transactions.
In order to import ledger transactions using Excel the mentioned AIF Web Service will be used.
Assumption: The assumption is that appropriate reference data such as main accounts, etc. was created in advance.
Data Model:
Table Name Table Description
LedgerJournalTable The LedgerJournalTable table contains all the defaulting and state information pertaining to a single journal. The transaction details of a journal are managed in the LedgerJournalTrans table.
LedgerJournalTrans The LedgerJournalTrans table contains the transaction detail information that pertains to a single journal. The individual transaction lines are also referred to as voucher lines. The journal is a record in the LedgerJournalTable table.

Data Model Diagram:
image
Walkthrough:
Connection
image
Add Data
image
Field Chooser
image
Accounting structure
image
LedgerJournalTable
Field Name Field Description
Journal batch number
Name
Description

clip_image001
LedgerJournalTrans
Field Name Field Description
Journal batch number
Voucher
Date
Company accounts
Account type
LedgerDimension
LedgerDimension.MainAccount
LedgerDimension.Department
Description
Debit
Credit
Currency

clip_image002
Sequence:
1. Publish All
Result:
Dynamics AX – General Journal
image
Dynamics AX – General Journal lines
image
Dynamics AX - Posting
image
SQL Trace:

Summary: For the purposes of small or medium data migration (data conversion) where performance is not a concern Excel can be used for import of ledger transactions into Microsoft Dynamics AX 2012. General Journal AIF Web Service (LedgerGeneralJournalService) can be used in Excel for import of ledger transactions. Excel template can be created and used for import of ledger transactions.
Imparted from Here
































Find out which version of Microsoft Dynamics AX you are using [AX 2012]

In some cases, the tasks that you can perform in Microsoft Dynamics AX depend on the version of the product that you are using.

This topic explains how to identify which version of Microsoft Dynamics AX 2012 R2 or Microsoft Dynamics AX 2012 R3 that you are using. For information about earlier versions of Microsoft Dynamics AX, see Overview of Microsoft Dynamics AX build numbers.

  1. To find the version number, in the upper-right corner of any page in Microsoft Dynamics AX, click the Help icon, and then click About Microsoft Dynamics AX. The version number is the application number, for example 6.2.1000.4051.
    • If the application number starts with 6.3, you are using Microsoft Dynamics AX 2012 R3.
    • If the application number starts with 6.2, you are using a version of Microsoft Dynamics AX 2012 R2. Make a note of the number and go to step 2.
  2. Refer to the following table to determine which version of AX 2012 R2 corresponds to the application number that you wrote down in step 1.

Application number

Version

6.2.1000.4051

Cumulative update 7 for Microsoft Dynamics AX 2012 R2

6.2.1000.1437

Cumulative update 6 for Microsoft Dynamics AX 2012 R2

6.2.1000.156

Cumulative update 1 for Microsoft Dynamics AX 2012 R2

   

AX 2012 – Data Migration Framework: Step-by-step setup

of course you need to download the Data Migration Framework from InformationSource. After having downloaded the Data Migration Framework, the next step is to extract the contents of the Zip file.
At this point you will want to launch the Setup for the Data Migration Framework. 

clip_image002

Moving from here a decision must be made on what is to be installed. 

clip_image003

Since I’m making the choice to install both Server and Client on a development instance of AX 2012 I will leave both checked. It’s worth to note the message contained within the first dialog box, around the fact that the server part must be installed on an AOS.
Moving along we must select the path in which the setup will install the application files to. 

clip_image004

After this, you should reach the final screen, indicating that the setup program has completed it’s task. 

clip_image005

When clicking on the finish button, the installation log file opens up for you. It’s worth scanning through to see if there are any errors. 

clip_image006

Now that we have completed the install, we need to double check that we have the Data Migration Framework bits ready for our use. Do this by browsing to the location in which you had chosen previously. In doing so, you should see a folder with similar contents as shown below. 

clip_image007

Now that we have verified that install completed successfully, lets move towards a point in the install documentation on TechNet

clip_image008

Specifically there is a warning, that states: “Because the staging environment is highly normalized and may require significant processing bandwidth, we recommend that you increase the Maximum buffer size setting for your environment while you migrate data. Use the Server configuration utility to set the value.” Lets take the advice of Microsoft and do just that.
This means you need to launch the server configuration utility, go to the database tuning tab, and change the buffer size from 24, to say 48. 

clip_image009

clip_image010

You will notice that in making such a change Microsoft warns of doing so. Since we are doing this on purpose, we can ignore this warning. However it’s valid to point out that after your done with the data migration framework, it’s best to change this setting back to 24. Further, you might find that 48 is still not big enough and you will need to increase further.
After doing this, and clicking apply you should take the option of allowing the configuration utility to restart the Microsoft Dynamics AX 2012 AOS instance. 

clip_image011

Now we have to move to importing the model file that came as part of the install bits for this offering. We perform this install either by using the PowerShell command console, or theAXUtil application. I’ve made the choice of using the AXUtil application. 

clip_image012

Finally after a successful install of the model file, to your target instance of Microsoft Dynamics AX 2012, you should launch AX. In doing so, it will detect a new model as been installed, and ask how you wish proceed. For this, we want to make the choice of ‘Compile and synchronize’ and then click ok. 

clip_image013

After the successful completion of the full compile and synchronization of the database, next action to take is a full CIL compile. This should take roughly 15 +/- minutes to complete. After completing this step, your instance of AX 2012 has the newly released Data Migration Framework deployed and setup. You should see the something similar to the following when done. 

clip_image014

Now that we have the Data Migration Framework deployed and setup.

Imparted from here

How to: Remove (Uninstall) a Model [AX 2012]

You can remove a model from a model store. However, it is recommend remove a model only if you want to permanently delete it.

You can use either Windows PowerShell cmdlets or the AXUtil command-line utility to perform this task.

Description: Caution noteCaution
Deletion of a model or layer may cause significant loss of business data, and also loss of metadata. When you run a command to delete a model, we recommend that you use the –Details or /verbose parameter to list the elements that may be deleted. In this way, you can determine the effect of the deletion on your environment.
·    Business data may be lost if the database schema is changed. The database schema is changed when tables or fields are removed.
·    Element IDs may be lost. If element IDs are lost, existing business data may become invalid.
·    Orphaned metadata elements in other models or layers are deleted.

If you want to upgrade a model or replace a model with a newer version, we recommend that you import the model over the existing model. For more information about how to import models, see How to: Export and Import a Model. We recommend this approach, because element IDs and element handles are assigned at installation. Therefore, if you delete a model, and then reimport that model or a newer version of it, element IDs and element handles are randomized, and data integrity can be affected. For more information about element IDs and element handles, see Maintaining Installation-Specific Element IDs and Element Handles.
Validate permissions
  • Validate that you have appropriate permissions to work with the model store:
    • Administrative permissions on the local computer
    • System Administrator rights in Microsoft Dynamics AX
    • In Microsoft SQL Server:
      • Membership in the Securityadmin server role on the SQL Server instance
      • Membership in the db_owner role in the Microsoft Dynamics AX database
Uninstall a model (Windows PowerShell)
  1. On the Start menu, point to All Programs, point to Administrative Tools, and then click Microsoft Dynamics AX Management Shell.
  2. At the Windows PowerShell command prompt, PS C:\>, type the following command, and then press ENTER.
Windows PowerShell
Uninstall-AXModel -Model <Modelname>
This command uninstalls the specified model. By default, a confirmation request is displayed.
For more information, see Uninstall-AXModel.
Uninstall a model (AXUtil)
  1. On the Start menu, click Command prompt.
  2. Navigate to the directory for the management utilities. Typically, the location of this directory is %ProgramFiles%\Microsoft Dynamics AX\60\ManagementUtilities.
  3. At the command prompt, type the following command, and then press ENTER.
4.  axutil delete /model:<name>

Modules names changes in MS Dynamics AX 2009 Vs. AX 2012

MODULES IN AX 2009

MODULES IN AX 2012

Inventory Management

•       Inventory Management

•       Product Information Management

Accounts Payable

•       Procurement and Sourcing

•       Accounts Payable

Accounts Receivable

•       Sales and Marketing

•       Accounts Receivable

General Ledger

•       General Ledger

•       Budgeting

•       Fixed Assets

•       Compliance and Internal controls

Cost Accounting

•       Cost Accounting

Bank

•       Cash and Bank Management

CRM

•       Moved to Sales and Marketing module

Master Planning

•       Master Planning

Production

•       Production control

Product Builder

•       Moved to Product Information Management

Shop floor Control

This Module is split into three and can be accessed from Home, Human resources and Production Control Modules.

•       Time and Attendance     – Human resources.

•       Clock In and Out – Home

•       Manufacturing execution – Production        control.

Human Resource

•       Human Resources

Questionnaire

•       Moved to Home

Expense Management

•       Travel and Expense

Projects

•       Project Management and Accounting (PSA)

Service

•       Service Management

Basic

•       Organizational Administration

Administration

•       System Administration

Imparted from

Dynamics AX functional consultant - job

Dynamics AX functional consultant

Shabaka Net - RiyadhSaudi Arabia

Job Description

To prepare the functional analysis, gap fit with Dynamics AX, determining modification requests to Dynamics AX and writing specifications or their development.

To implement Dynamics AX from A to Z on client site.

Skills

· At least two years of working experience with Dynamics AX Finance, Trade and Logistics is required with experience doing hands-on Configuration of Dynamics AX Finance, Trade & Logistics, Production / Retail / Project accounting as a functional.

· Excellent verbal and written communications skills.

· Ability/Experience to establish priorities, work independently, and proceed with objectives without supervision.

Education

Business or Information Technology / engineering or equivalent.

delete all the transaction inside a company in Dynamics ax

To delete all the transaction inside a company in the ax 2009 follow up below steps:
1- go to AOT
2- open the classes
3- search on  SysDatabaseTransDelete class
4- right click on the this class
5- choose open
6- click yes on the message box appear to you
7- info will appear to you "operation completed"

Top 10 issues discovered from Microsoft Dynamics AX 2012 implementations

Below headers of top 10 and details included on link below

1. Max Degree of Parallelism is not set to 1

2. No Pre-Allocation for Non Continuous Number Sequences with high consumption

3. Insufficient Auto Growth for Data and Log files

4. Processor bottleneck for Dynamics AX batch processing

5. Heavy Application database logging

6. Missing Clustered indexes

7. Wrong Index maintenance

8. Enabled debug in Production

9. Power Management set to Balanced

10. Kernel and Application are outdated and should be patched


http://blogs.msdn.com/b/axinthefield/archive/2013/06/18/top-10-issues-discovered-from-premier-field-engineer-dynamics-ax-health-check.aspx?CommentPosted=true#commentmessage

Debug a batch task AX 2012

Because batch tasks run in noninteractive mode and X++ executes in the common language runtime (CLR), to debug a batch task, you have to perform additional steps to configure the AOS and the Visual Studio debugger, in addition to setting up breakpoints.
First, configure the AOS for batch debugging. This is necessary for two reasons.
1-  The AOS modifies the X++ assembly to disable Just-In-Time (JIT) optimizations in the CLR. This is necessary to enable variables and object contents to be viewed and analyzed in the debugger.
2- The AOS produces source files containing the X++ code under the server Bin\XppIL\Source folder. You can open these files in Visual Studio to set breakpoints and perform common tasks, such as step ping into and step ping over.
Configure AOS for batch debuggingUse the Microsoft Dynamics AX Server Configuration Utility (see Figure below) to configure the AOS for batch debugging. The utility is available on the computer on which you installed the AOS. To do this, perform the following steps:
1. Open the Microsoft Dynamics AX Server Configuration Utility. Click Start > All Programs > Administrative Tools > Microsoft Dynamics AX 2012 Server Configuration.
2. Select the Enable Breakpoints to Debug X++ Code Running on This Server check box.
3. Click OK to close the utility, and then restart the AOS.
image
Configure Visual Studio for debugging X++ in a batch
To configure Visual Studio for batch debugging, attach to the AOS process Ax32Serv.exe by following these steps:
1. In Visual Studio, on the Debug menu, click Attach To Process.
2. When the Attach To Process dialog box opens (see Figure below), click Select to select Managed (v4.0) code, and then select the following check boxes:
              • Show Processes From All Users
              • Show Processes In All Sessions
3. Click Ax32Serv.exe, and then click Attach.
image
Clear the Enable Just My Code (Managed Only) check box, and then click OK.
After you complete these steps, you can open the X++ source code from the Bin\XppIL\Source folder on the server and set breakpoints.

Manage batch jobs AX 2012

After you create and schedule a batch job, you might want to check its status, review its history, or cancel it. The following sections describe some of the most common management tasks associated with batch jobs.

View and change the batch job status
The Batch Job list form provides a snapshot view of the current state of batch jobs. The list displays the progress and the status of running and completed jobs. It also displays any jobs that are scheduled to start soon.
You can change the status of a batch job by selecting the batch job in the list and then following these steps:
1. Click Functions, and then click Change Status.
2. In the Select New Status dialog box, select a new status for the job. For example, if the status is Waiting, you can temporarily remove the batch job from the waiting list by changing the status to Withhold.

Tip If a job exits with a status of Error/Ended and you want to rerun the job, change its status to Waiting. The job will automatically be picked up by the server for execution.

You can cancel a batch job by changing its status to Canceling. Tasks in the Waiting or Ready state are changed to Not Run; currently executing tasks are interrupted, and their status is changed to Canceled.

Control the maximum retries
If an AOS fails because of an infrastructure failure or a power outage while a batch task is executing, the batch framework has the built-in capability to retry tasks after the AOS is restarted. Any tasks that were left in an executing state, and that have not reached the maximum retry limit, are changed to the Ready state and will run shortly after the failure.

Tip If you create custom tasks and want to enable retries, design the task so that it is idempotent—that is, it can be executed multiple times without unexpected consequences.

You can modify the Maximum Retries attribute for each batch task on the General tab. By default, the value is set to 1; when the Actual Retries field on the Update tab exceeds the maximum number of retries, the batch task fails. When this happens, the recurrence that is set for the batch job is not honored, and the status of the batch job is set to either Success or Error.

Review the batch job history
You can view a history of all batch jobs that have finished running in the Batch Job History form at System Administration > Inquiries > Batch Job History. This form displays detailed information about the status of the jobs, including any messages encountered while the batch job was running.

You can also view the logs for each batch job as follows:
■ To view log information for an entire batch, select a batch job, and then click Log.
■ To view log information for individual tasks, select a batch job, and then click View Tasks. In the Batch History list form, select a task, and then click Log.

Tip In the batch job settings, you can specify when log information is written to the history tables: Always (the default), On Error, or Never. Use On Error or Never to save disk space for batch jobs that run constantly. This option is located on the General tab of the
Batch Job form.

Inside Dynamics AX 2012 Book

Manage batch execution AX 2012

The final step in implementing a batch job is to manage the execution process. Before a batch job can be executed on an AOS instance, you must configure the AOS instance as a batch server and set up the batch groups that tell the system which AOS instance should execute the job.
In addition to these initial configuration tasks, you’ll likely need to manage the batch tasks and jobs: checking status, reviewing history, and sometimes canceling a batch job. You’ll probably also need to debug a batch task at some point.

The following sections describe how to configure an AOS instance as a batch server and set up batch groups, and the next 2 posts will describe manage batch jobs and debug a batch task.

Configure the batch server
You can configure an AOS instance to be a batch server, including specifying when the batch server is available for processing and how many tasks it can run, by using the Server Configuration form.
The Server Configuration form is located at System Administration > Setup > System > Server Configuration.
Note that the first AOS instance is automatically designated as a batch server, but you can configure additional AOS instances manually as batch servers.

Tip Use multiple batch servers to enable parallel processing and increase processing throughput.

1. In the Server Configuration form, select a server in the left pane.
2. Select the Is Batch Server check box to enable batch processing on the server, as shown in Figure below.

image

3. On the Batch Server Schedule FastTab, click Add to enter a new schedule. Enter the maximum number of batch tasks that can be run on the AOS instance at one time. The server continues to pick up tasks from the queue until it reaches its maximum.
4. Enter a starting time in Start Time and an ending time in End Time to specify the time window in which the server processes batch jobs. Press Ctrl+N to enter an additional time window.

Tip It’s a good idea to exclude a server from batch processing when it is busy processing regular transactions. You can set server schedules so that each AOS instance is available for user traffic during the day and batch traffic overnight. Keep in mind that if the server
is running a task when its batch processing availability ends, the task continues running to completion. However, the server doesn’t pick up any more tasks from the queue.

Create a batch group
A batch group is a logical categorization of batch tasks that lets a user (typically a system administrator) determine which AOS instance runs the batch task. This section describes how to create a batch group so that it can be assigned to a specific server for execution. The first step is to create batch groups by using the Batch Group form at System Administration > Setup > Batch Group.

To create a batch group, press Ctrl+N in the Batch Group form, and then type a name and description for the batch group. The Batch Group form is shown in below

image

Note By default, the system contains an empty batch group that can’t be removed. This is a default batch group for tasks that are not explicitly assigned to a group.

After you create batch groups, assign each group to a server as follows:
1. In the Server Configuration form (shown in Figure below), click the Batch Server Groups FastTab.
The Selected Groups list shows the batch groups specified to run on the selected server.
2. In the Remaining Groups list, select a group, and then click the left arrow button to add this group to run on the selected server.

image

Note  you can assign each group to a server using Batch Servers in Batch Group form

Imparted from Inside Dynamics AX 2012 Book

Create and execute a batch job AX 2012

Microsoft Dynamics AX 2012 includes numerous batch jobs that perform operations such as generating reports, creating sales invoices, and processing journals. However, in several situations, organizations need to create their own batch jobs. The batch framework provides full flexibility in the types of jobs that you can create. This section walks you through the following steps, which are required for creating, executing, and managing a batch job:
1. Create a batch-executable class.
2. Create a batch job and define the execution schedule.
3. Configure a batch server and create a batch group. (It be will explained in another post)
4. Manage the batch job. (It will be explained in another post)
Create a batch-executable class
The first step in developing a batch job is to define a class that can be executed as a batch task. Many classes included with Microsoft Dynamics AX 2012 are already enabled for batch processing. You can also design a batch-executable class, as shown in the following example:
public class ExampleBatchTask extends RunBaseBatch

To run as a batch task, a class must implement the Batchable interface. The best way to implement the interface contract is to extend the RunBaseBatch abstract class, which provides much of the necessary
infrastructure for creating a batch-executable class. An alternative is to use the SysOperation framework, which provides additional advantages compared to extending the RunBaseBatch class. Will post more information about the SysOperation framework Later.
Table below describes the methods that must be implemented when you extend the RunBaseBatch class. The following sections describe these methods in more detail.
Method Description
run Contains the core logic for your batch task
pack Serializes the list of variables used in the class
unpack Deserializes the list of variables used in the class
canGoBatchJournal Determines whether the class appears in the Batch Task form


run methodYou implement the core logic of your batch class in the run method. The run method is called by the batch framework for executing the task defined within it. You can run most of the X++ code in this method; however, there are some limitations on the operations that you can implement. For example, you can’t call any client logic or dialog boxes. However, you can still use the Infolog class. All Infolog and exception messages are captured when the batch class executes, and they are stored in the batch table. You can view these later in the Batch Job form or the Batch Job History form, both of which are located under System Administration > Inquiries > Batch Jobs.

Note If an error message is written to the Infolog, it does not mean that the task has failed; instead, an exception must be thrown to indicate the failure
pack and unpack methods
A class that extends RunBaseBatch must also implement the pack and unpack methods to enable the class to be serialized. When a batch task is created, its member variables are serialized by using the pack method and stored in the batch table. Later, when the batch server picks up the task for execution, it deserializes class member variables by using the unpack method. So it’s important to provide a correct list of the  variables that are necessary for class execution. If any member variable isn’t packable, then the class can’t be serialized and deserialized to the same state.
The following example shows the implementation of the pack and unpack methods:
public container pack()
{
                         return [#CurrentVersion,#CurrentList];
}
public boolean unpack(container _packedClass)
{
                        Version version = RunBase::getVersion(_packedClass);
                        switch (version)
                       {
                                  case #CurrentVersion:
                                                         [version,#CurrentList] = _packedClass;
                                                         break;
                                 default:
                                                        return false;
                     }
                     return true;
}

The #CurrentList and #CurrentVersion macros that are referenced in the preceding code must be defined in the class declaration. Using a macro simplifies the management of variables in the class. If you add or remove variables later, you can manage the list by modifying the macro. The #CurrentList macro holds a list of the class member variables to pack, as shown here:
#define.CurrentVersion(1)
#localmacro.CurrentList
               methodVariable1,
               methodVariable2
#endmacro
canGoBatchJournal method
When a system administrator creates a new batch task by using the Batch Task form, the canGoBatchJournal method determines whether the batch task class appears in the list of available classes. For an example of how to use canGoBatchJournal.


Create a batch jobThe second step in developing a batch job is to create the batch job and add batch tasks. You can create a batch job in three ways:
■ By using the dialog box of a batch-enabled class
■ By using the Batch Job Designer form
■ By using the Batch API (It be will explained in another post)
The method you use depends on the degree of flexibility that you need and the complexity of the batch job. To create a simple batch job, consisting of a single task with no dependencies, you typically use the dialog box of a batch-executable class; to create a more complex batch job, consisting of several tasks that might have dependencies, use the Batch Job form; to create a highly complex or very large batch job, or one that needs to be integrated with other business logic, use the Batch API.
The following sections provide an example of using each method.
Create a batch job from the dialog box of a batch-executable class
The simplest way to run a batch-executable class as a batch job is to invoke the class by using a menu item. A menu item that points to a batch-executable class automatically opens a dialog box that lets
the user create a batch job. On the Batch tab of the dialog box, select the Batch Processing check box, as shown for the Change based alerts class in Figure below. When you select Batch Processing and click
OK, a new batch job with the task that represents the batch-executable class is created. The batch job then runs asynchronously at the date and time you specify. You can also set up recurrences or alerts
for the job by clicking the appropriate button on the right side of the dialog box. You can also specify the batch group for the task by using the drop-down list.

image
Create a batch job by using the Batch Job formYou can open the Batch Job form from several places. For example, you can open it by clicking Batch Jobs from System Administration > Inquiries > Batch Jobs or by selecting My Batch Jobs (for users) from Home > Inquiries > My Batch Jobs. Both menu items open the same form, but the information that is presented in the form differs, depending on the menu item that you use to open it. Depending on how you open the form and your level of access, you can view either the batch jobs that you have created or all batch jobs that are scheduled in the system.
Press Ctrl+N to create a new batch job, and then enter the details for the job in the grid or on the General tab: a description, and the date and time at which you want the job to start. You can also set up recurrence for the batch job by clicking Recurrence on the menu bar, and then entering a range and pattern for the recurrence.
Note If you don’t enter a date and time, the current date and time are entered automatically.
figure below show Batch Job Form
image
Batch tasks form
image
To create a task, do the following:
1. Press Ctrl+N to create the task.
2. In Task Description, enter a description of the task.
3. In Company Accounts, select the company in which the task runs.
4. In Class Name, select the process that you want the task to run. Classes appear in a lookup list containing all available batch-enabled classes. The lookup list appears only if the CanGoBatchJournal property is enabled.
5. In Batch Group, select a batch group for the task if necessary.
6. Save the task by pressing Ctrl+S.
7. Specify class parameters if necessary. As mentioned in previous sections, each batch task represents
a batch-executable class. Sometimes you need to set up parameters for that class.
For example, you might need to specify posting parameters for invoice posting. To do that, click Parameters on the menu bar in the Batch Tasks form. A dialog box specific to the selected class is displayed.
Note If you are creating a custom batch class, you must design the parameters form manually. If you implement a batch based on the SysOperation framework, this process is highly simplified. After you specify the necessary parameters and click OK, the class parameters are packed and saved in the Batch table and then are restored when the class executes.
8. Set up dependencies or advanced sequencing between tasks, if necessary.

After you create the batch job and add tasks to it, you can use the Batch Tasks form to define dependencies between the tasks. If no dependencies or conditions are defined within a job, the batch server automatically executes the tasks in parallel. (To configure the maximum number of parallel tasks, use the Maximum Batch Threads parameter in the Server Configuration form.)
If you need to use advanced sequencing to accommodate your business process flow, you can use either the Batch Tasks form or the Batch API. You can use these tools to construct complex dependency
trees that let you schedule batch jobs tasks in parallel, add multiple dependencies between batch tasks, choose different execution paths based on the results of the previous batch task, and so on.
For example, suppose that the job, JOB1, has seven tasks: TASK1, TASK2, TASK3, TASK4, TASK5, TASK6, and TASK7, and you want to set up the following sequence and dependencies for it:
■ TASK1 runs first.
■ TASK2 runs on completion (Ended or Error) of TASK1 (regardless of the success or failure of TASK1).
■ TASK3 runs on success (Ended) of TASK2.
■ TASK4 runs on success (Ended) of TASK2.
■ TASK5 runs on failure (Error) of TASK2.
■ TASK6 runs on failure (Error) of TASK3.
■ TASK7 runs on success (Ended) of both TASK3 and TASK4.
dependency tree for JOB
image
To define these task dependencies and to tell the system how to handle them, select a child task—for example, TASK2—from the preceding list, and then do the following:
1. In the Batch Tasks form, click in the Has Conditions grid, and then press Ctrl+N to create a new condition.
2. Select the task ID of the parent task, such as TASK1.
3. Select the status that the parent task must reach before the dependent task can run. For example, TASK2 starts when the status of TASK1 becomes Ended or Error.
4. Press Ctrl+S to save the condition.
5. If you enter more than one condition, and if all conditions must be met before the dependent task can run, select a condition type of All.
Alternatively, if the dependent task can run after any of the conditions are met, select a condition type of Any.
You can use the Batch Tasks form to define how the system handles task failures. To ignore the failure of a specific task, select Ignore Task Failure for that task on the General tab. If you select this option, the failure of the task doesn’t cause the job to fail. You can also use Maximum Retries to specify the number of times a task should be retried before it fails.
Imparted from Inside Dynamics AX 2012 Book.

Batch processing in Microsoft Dynamics AX 2012

Batch processing is a non interactive task-processing technique where users create batch jobs to organize appropriate types of tasks to be processed as a unit. Batch processing has some important advantages: it lets users schedule batch tasks and define the conditions under which they execute, add the tasks to a queue, and set them to run automatically on a batch server.
After execution is complete, the batch server logs any errors and sends alerts.
A batch job might involve printing reports, closing inventory, or performing periodic maintenance. By scheduling a batch job to process these types of resource-intensive tasks in off-peak hours, users can avoid slowing down the system during working hours.
Table below describes how standard batch processing concepts are represented in Microsoft Dynamics AX.
Concept Description
Batch task The smallest unit of work that can be executed using the batch framework. It is a
batch-executable class that contains business logic to perform a certain action.
The Microsoft Dynamics AX classes that are used for batch tasks are designated
to run on the server. These tasks can run automatically as part of a batch job on
the AOS. This version of the product has limited support for client batch jobs; it
is recommended that you use server-side batch jobs to take full advantage of
the new features in Microsoft Dynamics AX 2012.
Batch job A complete process that achieves a goal, such as printing a report or performing
the inventory closing process. A batch job is made up of one or more batch tasks.
Batch group A logical categorization for batch tasks that lets administrators specify which AOS
instance runs a particular task. Tasks that are not explicitly assigned to a batch
group are, by default, assigned to an empty (default) group.
Batch server An AOS instance that processes batch jobs.

Common uses of the batch framework
Organizations can use the batch framework to perform asynchronous operations in a variety of scenarios. Typically, organizations create batch jobs to address the following kinds of needs:
■ Enable scheduling flexibility The batch framework can perform periodic tasks on a regular schedule, such as data cleanup or invoice processing. For example, to run invoice processing at the end of every month, you can set up a recurring batch job that runs at midnight on the last working day of each month. The batch framework automatically picks up the job and processes pending invoices according to the specified schedule.
■ Control the order in which tasks execute With the batch framework, you can develop a workflow or perform a complex data upgrade in a sequence that you specify. You can also set up dependencies between the tasks and create a dependency tree that ensures that certain tasks run in sequence while others run in parallel.
■ Enable conditional processing Decision trees can help you implement a reliable way of processing data. Developers or system administrators can set up dependencies between tasks in such a way that different tasks are executed, depending on whether a particular task succeeds or fails. System administrators can also set up alerts so that they are notified if a job fails.
■ Improve performance by using parallelization The batch framework lets you take advantage of multithreading, which ensures that your processor’s capabilities are used fully. This is particularly important for long-running processes, such as inventory closing. You can improve performance further by breaking a process into tasks and executing them against different AOS instances, thus increasing the throughput and reducing overall execution time.
■ Implement advanced logging and profiling The batch framework lets you see what errors or exceptions were thrown the last time the batch ran, and it also shows you how long a process takes to execute. Advanced logging and the new profiling capabilities are also useful for performance benchmarking and security auditing.
Performance
The new capability to run larger and more complex batch jobs has required performance enhancements to the batch framework. In Microsoft Dynamics AX 2012, the batch framework is designed to be a server-side component. This lets you design multithreaded server processes in a controlled manner. By configuring the number of parallel execution threads and servers, defining the set and order of tasks for processing, and setting the execution schedule, you can achieve greater scalability across your hardware.
As mentioned earlier, the batch framework is now designed to run X++ that has been compiled as .NET CIL code for batch jobs. This significantly improves performance compared to Microsoft Dynamics
AX 2009, which ran interpreted X++ code. Compared to the interpreted code, garbage collection is much better, and because of session pooling, scheduling new batch jobs is less resource intensive. You can also profile the performance of jobs by using Microsoft Visual Studio Performance Profiler.

Microsoft developers use the batch framework as a foundation for many performance-critical processes, such as maximizing hardware scalability during a data upgrade and maximizing throughput during journal posting. For more information about how Microsoft uses the batch framework for performance-critical processes, see the white paper “Journal Batch Posting,” available at http://www.microsoft.com/en-us/download/details.aspx?id=13379.

Imparted from Inside Dynamics AX 2012 book

Troubleshoot the reporting framework [AX 2012]


This Post contains some of the most common reporting framework issues and possible solutions.
You can find related information posted on the Microsoft Dynamics AX Product Forum at
https://community.dynamics.com/product/ax/f/33.aspx.


The report server cannot be validated
If you cannot validate the report server, do the following:
■ Click the Create button in the Reporting Servers form, which is located at Tools > Business Intelligence Tools > Reporting Servers, and make sure that a report folder and data source have been created on the report server. Click the Validate button.
■ Ensure that firewall settings are configured appropriately on the computer that is running the
report server.
■ Ensure that both the report manager and report server URLs are correct.
■ Ensure that the Microsoft Dynamics AX user has permissions on the computer that is running
the report server.

Create a new number sequence in ax 2012

Number Sequence Creation:

Here I want to design a form named FirstForm with DataSource FirstTable

I want to create sequence  like "AX00001---------AX99999".

Step 1

Create an EDT - String Type

So, I created an EDT named "AXSeqEDT" with label "AX Seq"

Drag into Table(FirstTable)àFields

Step 2

Now create a new Number Sequence

Path for creating num Sequence is

"Module:: Organization administration.......Common.........Number sequences......Number sequences"

Click on New(Number Sequence)

Now number Sequence form will be opened----That contains 4 sections.

Section 1.Identification.....Specify the NumberSeqCode and Name

Section 2.Scope Parameters... Select the Scope from the Dropdown

Section 3.Segments.... Add the constant and alphanumeric (by clicking the add button and selecting from drop down)

Section 4 .General.....Checkmark for continous and Specify the "smallest and largest and Next" Fields

Now Save Ur Settings

Step 3

Now add the Respective manual-code to class - NumberSeqModuleURMODULE

And Table - URMODULEParameters.

So I am creating number sequence based on HRM Module.....So iam using classNumberSeqModuleHRM and Table HRMParameters

Now go to AOT---Classes-NumberSeqModuleHRM---loadModule()

Add the code here...

Note::Here we can add the code seeing the existing implementation

The Added Code is::

/* setup discussion number sequence - it is global */

    datatype.parmDatatypeId(extendedtypenum(AXSeqEDT));

    datatype.parmReferenceHelp(literalstr("@SYS32633"));

    datatype.parmWizardIsContinuous(true);

    datatype.parmWizardIsManual(NoYes::No);

    datatype.parmWizardIsChangeDownAllowed(NoYes::No);

    datatype.parmWizardIsChangeUpAllowed(NoYes::No);

    datatype.parmWizardHighest(99999);

    datatype.parmSortField(12);

    this.create(datatype);

Now Goto AOT---Tables---HRMParameters---methods-----click on new method


Add the code In the New method

Note::Here we can add the code seeing the existing implementation

The Added Code is

static client server NumberSequenceReference numRefAXSeqEDT()

{

return NumberSeqReference::findReference(extendedTypeNum(AXSeqEDT));

}

Step 4

In order to add our newly created number sequence reference to our Module write the following Job and Execute it

Below job is important to run because without it your new number sequence will not be available to number sequence form under Parameters. This is the change in behavior from AX 2009 where all new number sequence loads while restarting the Dynamic AX. In AX 2012 all the number sequence created to system while installation, so restarting the AOS wont effect in loading the new number sequence, that is why it is important to run the job to load new number sequences.

The Code added in The Job is

static void jobName(Args _args)

{

    NumberSeqModuleHRM  NumberSeqModuleHRM = new NumberSeqModuleHRM();

    ;

    NumberSeqModuleHRm.load();

}

Step 5

After executing the Above Job, our newly created number Sequence reference "AX Seq" will be added to HRM Module----Number sequence setup form

Lets Check it

Now click on Number Sequence and Identify the newly created Number Seq Reference

After Identifying the Number Sequence Reference ----Allot the Number Sequence Code to the Number Sequence Reference.....By selecting from the drop down list

Step 6

Now add the Code in Create method of Forms Datasource methods

Goto-AOT-Forms-FirstForm-Datasources-FirstTable-Methods-Override method(Create)

public void create(boolean _append = false)

{

    ;

super(_append);

    FirstTable.AXSeqEDT = NumberSeq::newGetNum(HRMParameters::numRefAXSeqEDT(),true).num();

}

Step 7

Now save all ur settings.....Now Open our form-FirstForm

Imparted

Microsoft Dynamics AX 2012 Development Cookbook


Overview

  • Develop powerful, successful Dynamics AX projects with efficient X++ code with this book and eBook
  • Proven recipes that can be reused in numerous successful Dynamics AX projects
  • Covers general ledger, accounts payable, accounts receivable, project modules and general functionality of Dynamics AX
  • Step-by-step instructions and useful screenshots for easy learning
  • Numerous development tips and tricks for daily usage
  • This book is an update to Microsoft Dynamics AX 2009 Development Cookbook

Table of Contents

Preface
Chapter 1: Processing Data
Chapter 2: Working with Forms
Chapter 3: Working with Data in Forms
Chapter 4: Building Lookups
Chapter 5: Processing Business Tasks
Chapter 6: Integration with Microsoft Office
Chapter 7: Using Services
Chapter 8: Improving Development Efficiency
Chapter 9: Improving Dynamics AX Performance
Index
  • Chapter 1: Processing Data
    • Introduction
    • Creating a new number sequence
    • Renaming the primary key
    • Merging two records
    • Adding a document handling note
    • Using a normal table as a temporary table
    • Copying a record
    • Building a query object
    • Using a macro in an SQL statement
    • Executing a direct SQL statement
    • Enhancing the data consistency check
    • Exporting data to an XML file
    • Importing data from an XML file
    • Creating a comma-separated value file
    • Reading a comma-separated value file
    • Using the date effectiveness feature
    • Chapter 2: Working with Forms
      • Introduction
      • Creating a dialog
      • Handling a dialog event
      • Building a dynamic form
      • Adding a form splitter
      • Creating a modal form
      • Modifying multiple forms dynamically
      • Storing last form values
      • Using a tree control
      • Building a checklist
      • Adding the View details link
      • Chapter 3: Working with Data in Forms
        • Introduction
        • Using a number sequence handler
        • Creating a custom filter
        • Creating a custom instant search filter
        • Building a selected/available list
        • Preloading images
        • Creating a wizard
        • Processing multiple records
        • Coloring records
        • Adding an image to records
        • Chapter 4: Building Lookups
          • Introduction
          • Creating an automatic lookup
          • Creating a lookup dynamically
          • Using a form for building a lookup
          • Building a tree lookup
          • Displaying a list of custom options
          • Another way of displaying custom options
          • Building a lookup based on record description
          • Building the Browse for Folder lookup
          • Building a lookup for selecting a file
          • Creating a color picker lookup
          • Chapter 5: Processing Business Tasks
            • Introduction
            • Using a segmented entry control
            • Creating a general journal
            • Posting a general journal
            • Processing a project journal
            • Creating and posting a ledger voucher
            • Changing an automatic transaction text
            • Creating a purchase order
            • Posting a purchase order
            • Creating a sales order
            • Posting a sales order
            • Creating an electronic payment format
            • Chapter 6: Integration with Microsoft Office
              • Introduction
              • Creating an Excel file
              • Reading an Excel file
              • Creating a Word document from a template
              • Creating a Word document with repeating elements
              • Creating a Microsoft Project file
              • Sending an e-mail using Outlook
              • Chapter 7: Using Services
                • Introduction
                • Consuming the system query service
                • Consuming the system metadata service
                • Consuming an existing document service
                • Creating a document service
                • Consuming a document service
                • Using an enhanced document service
                • Creating a custom service
                • Consuming a custom service
                • Consuming an external service
                • Chapter 8: Improving Development Efficiency
                  • Introduction
                  • Creating an editor template
                  • Modifying the Tools menu
                  • Modifying the right-click context menu
                  • Searching for an object in a development project
                  • Modifying the Personalization form
                  • Modifying the application version
                  • Chapter 9: Improving Dynamics AX Performance
                    • Introduction
                    • Calculating code execution time
                    • Writing efficient SQL statements
                    • Caching a display method
                    • Using Dynamics AX Trace Parser
                    • Using SQL Server Database Engine Tuning Advisor