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 

Monday, November 28, 2011

Error while firming the planned order: "Lot ID for the production not specified"

Hi,

Sometimes it is possible to facing the error "LotID for the production is not specified." while firming the planned orders from 'Master Planning > Planned orders details'.

Solution:
Please make sure the number sequence settings for the Production must be setup as "Automatically". The above error will come if it is selected as 'Manual'.

Hope this helps.

/Ashlesh

Thursday, November 24, 2011

Enterprise Portal: Failed to “Generate Proxies”

Hi,

While creating proxy class from AOT and after generating proxy for the same from Tools->Dev. Tools-> Web Dev. -> Proxy, using Generate Proxy form. It gives the errors "ClrObject static method invocation error."

To overcome this,
1. go to AOT->Classes->SysEPDeployment->createDevWebsiteProxyDir().
2. find and comment below line,

dir = epSharepointAdmin.GetAppCodeDirectoryFromSiteId(guid2str(epGlobalParam.DevelopmentSiteId));
3. replace it with (locate your virtual directory app_code folder)
dir = "C:\\Inetpub\\wwwroot\\wss\\VirtualDirectories\\sharepoint80\\App_Code"; 
4. Save the class file.

Now, again run the 'Generate Proxy' class. 
 
It works fine.

Thanks.
/Ashlesh

Tuesday, November 22, 2011

EP tools are not visible in VS 2008 toolbox


Hi,

Recently i faced a problem that i can able to install EP development tools successfully. I can also select the Mciforost Dynamics Web project template while creating new Website. 
But not able to find any of the item of AX EP toolbox in the VS 2008 toolbox. So, after finding net a lot i found the below solution.


1. Got to choose item by right clicking on the toolbox in VS 2008.
2. in the .Net Framework component tab, browse for C:\Program Files\Microsoft Dynamics AX\50\Client\Bin\Microsoft.Dynamics.Framework.Portal.dll file.
3. Select all the items starts with AX*, and clickes ok.
4. restart the VS 2008.

Thats all. Hope it helps to someone.


Regards,
/Ashlesh

Thursday, November 17, 2011

AX 2009 - Enterprise Portal Documentation

Hi all,
I have installed and configured the Enterprise Portal for AX 2009 at our end. I faced troubles couple of times to successfully configured the EP on Windows Server 2008 R2 (64 bit) with Sharepoint Server 3.0 during that time. I found the web and got some very helpful documents on some blogs. I am sharing those with you. Hope it will reduce your time to install and configure the EP on  AX2009.

You can find the EP docs from below link:
AX 2009 - EP Documents

Thanks & Regards,
/Ashlesh