Tuesday, January 17, 2012

Sales and purchase prices in relation to the item price (Trade Agreements) setup in Microsoft Dynamics AX 2009

Hi,
This is a wonderful help on item price setups in trade agreements for a particular customer/vendor.

Please visit this blog for more detail.

Thanks.
/Ashlesh

Monday, December 26, 2011

Run AX client without using Load Balancer (though it setup already)

Hi,

It is  possible to configure/setup a client to open a dedicated connection to a specified AOS, although the AOs is member of a simple AOS cluster.


USE this command: AX32.exe -loadbalance=0 -aos2=<server name>:<port number>


Thanks.

Monday, December 19, 2011

Moving objects between Layers in AX

Hi,

I found a very good post to moving objects between two different layers in AX. You can find it here.

Hope its helps.

Thanks & Regards,
/Ashlesh

Sequence of all methods which are called when a RunBaseBatch process is executed


Hi,
I found one useful information from one of the blog. It might be useful to someone.
It can be handy to have detailed knowledge on the runbaseBatch class. In this tutorial I will explain the calling sequence of the RunBaseBatch class with a query (select button).
We will start this process with a static construct function that will force the runbaseBatch process to run on the server. 
In the left column of below table is shown the method name of the runbase batch and the location where it is running. The order of the lines in the table is also the order AX will execute the methods.
(Note: The runbase mechanism calls sometimes methods twice, these duplicate call are removed from this list.)

Server construct
Our constructor will execute the new method
Server new

Server prompt

Server unpack

Server showdialog

Server pack

Client new
Reconstruct the class on the AX client
Client unpack
Get the values from the previous run
Client canGoBatch
Do we need to show the batch tab page
Client prompt

Client showdialog
Do we need to show dialog
Client caption
Set the caption of the dialog
Client queryRun
Get the query object (if exist)
Client showQueryValues
Do we need to query values on the general tab page of the dialog
Client showQuerySelectButton
Do we need to query select button on the dialog
Client showDefaultButton
Do we need default button
Client showClearButton
Do we need clear button
Client dialog
Build your dialog (don’t remove super otherwise you don’t see the batch tab page
Client dialogPostRun
Used to make additional modification to the dialog (field High), set overload methods

Finally our dialog appears on the screen.
Next we press the OK button. The next methods of the runbaseBatch will be executed:

Client getFromDialog
We get the values from the dialog , don’t remove super otherwise batch and select info is gone
Client validate
Check if all dialog values are valid
Client pack
Store the values in the SysLastValue table
Server unpack
Readout the values from the SysLastValue table
Server canGoBatch
Check if we have to run in batch
Server run
Run the process (can be from batch process)


Regards,
/Ashlesh

Thursday, December 15, 2011

Override dialog controls event on dynamic dialog


Hi,

I found a useful thing from the dev. cook book ax 2009.

To override the dialog fields (controls) event from the dynamically created dialogs.

Usage of dialogSelectCtrl() sometimes might appear a bit limited as this method is only
invoked when the dialog control loses its focus. No other events can be controlled, and it can
become messy if more controls needs to be processed. Actually, this method is called from
the selectControl() of the form, which is used as a base for the dialog.

As mentioned earlier, dialogs created using the Dialog class are actually forms, which are
dynamically created during runtime. So in order to extend event handling functionality on
dialogs, we should utilize form event handling features.

The Dialog class does not provide direct access to form event handling functions, but we can
easily access the form object within the dialog. Although we cannot create the usual event
handling methods on runtime form controls, we can override this behavior. Let's modify the
previous example to include more events. We will add an event on the second tab page, which
is triggered once the page is activated. First, we have to override the dialogPostRun()
method on the Class1 class:

public void dialogPostRun(DialogRunbase dialog)
{;
dialog.formRun().controlMethodOverload(true);
dialog.formRun().controlMethodOverloadObject(this);  //this refers the current class object
super(dialog);
}

Here, we enable event overriding on the form after it is fully created and is ready for
displaying on the screen. We also pass the CustSelect object as argument for the
controlMethodOverloadObject() to make sure that form "knows" where overridden
events are located.

Next, we have to create the method that overrides the tab page event:

void TabPg_2_pageActivated()
{;
info('Tab page activated');
}

The method name consists of the control name and event name joined with an underscore.
But before creating such methods, we first have to get the name of the runtime control. This
is because the dialog form is created dynamically, and Dynamics AX defines control names
automatically without allowing the user to choose them. In this example, I have temporary
added the following code to the bottom of dialog(), which displayed the name of the

Details tab page control when the class was executed:

info(tabDetails.name());

Now, run the class again, and select the Details tab page. The message should be displayed
in the Infolog.

Hope it helps.

Regards,
/Ashlesh

Monday, December 5, 2011

Tools | Options will crash AX 2009

Hi,
Recently i am facing a crashing problem with AX 2009 while I am going to Files > Tools > Options, it will crash the AX 2009 client application.

Solution: Follow below steps to overcome this issue.
1. go to Administrator > Setup > Checklist > Installation Checklist
2. click on Compile Application to fully complile the application.

After completing the above step you will be able to open the Options form.

Hope it helps.

Thanks,
/Ashlesh

Sunday, December 4, 2011

How to capture the modified field in runbasebatch

Hi,

RunBase.dialogSelectCtrl Method
 
When using the dialog class for dialog, this method is called whenever a control is selected. 
 
To enable this callback, the allowUpdateOnSelectCtrl method must have been set true.
 
You have to add to the dialog() method, after the super's call add the line

dialog.allowUpdateOnSelectCtrl(true);

and then each time a dialog method is entered the method dialogSelectCtrl() is executed, you can control there the modified
field.

If you have any doubt about the behaviour have a look at the class BOMHierarchyCheckJob.
 
Hope it helps.
 
Regards,
/Ashlesh