Skip to main content

Posts

Showing posts with the label AX 2009

How to implement Runbase form in AX

Today I had a requirement that allow users to run Outlook synchronization process in batch rather sync it manually using out of the box functionality. Let's have a look on existing functionality and then extend it to achieve the requirement of running it in batch. Existing functionality in AX Home> Periodic > Synchronize [AOT form name is smmOutlookSyncrhonization ] As you can see someone has to manually sync outlook emails to AX acvitities or viceversa. Extended functionality in AX Let's implement this functionality in batch so users can set recurrence the Sync. Create a new class; class SyncOutLookEmails_RunbaseForm extends RunBaseBatch {     // Packed     TransDate            testDate; // I am using this variable for own testing purpose     #define.CurrentVersion( 2 )     #define.Version1( 2 )     #lo...

Unit Conversion Check AX2009 Vs AX2012

AX 2009 if(!UnitConvert::canConvert(this.inventTableModuleInvent().UnitId, this.SAB_ProdPickingUOM, this.ItemId)) AX 2012 unitConvFound = UnitOfMeasureConverter::canBeConverted(UnitOfMeasure::findBySymbol(this.inventTableModuleInvent().UnitId).RecId,                                                              UnitOfMeasure::findBySymbol(this.SAB_SalesPickingUOM).RecId,                                                                    this.Product);

Show methods in AX lookups

This sample code is used to show Customer Name in lookup, In AX 2009 we had name field in CustTable but now its moved to DirPartyTable. We still have name() in CustTable which we can use to display name in lookups. AX 2009 client static void lookupInterCompanyItemId(FormStringControl   lookupCtrl, DataAreaId _dataAreaId = "") {     SysTableLookup          sysTableLookup = SysTableLookup::newParameters(tablenum(InventTable), lookupCtrl);     Query                   query = new Query();     QueryBuildDataSource    qbds = query.addDataSource(tablenum(InventTable));     ;     sysTableLookup.addLookupfield(fieldnum(InventTable, ItemId));     sysTableLookup.addLookupfield(fieldnum(InventTable, ItemName));   ...

InventTrans table data model changes in AX 2012 vs AX 2009

The purpose of this post is to give an overview about the changes been made in the Dynamics AX 2012 data model related to inventory transactions. For more details; how to implement code changes for inventTrans table the best resource is this white paper  Implementing InventTrans refactoring for Microsoft Dynamics AX Applications AX2012 Before AX2012, the only table used for recording all the inventory transactions was  InventTrans .  In AX2009, a lot of data in InventTrans is either redundant or fields are used to represent a specific type of transaction like sales, purchase, transfer etc. In AX2012, the base is still the same i.e. every inventory still gets recorded in the  InventTrans  but the only difference is that the table has been more normalized now. A new table has been added called  InventTransOrigin  which is actually now holding the relationship between the originating tables (transaction tables) and InventTrans . The InventT...

AX to SQL data dictionary synchronization issues

One of my clients restored their AX database from PROD to DEV environment for AX 2009 and on database sync following error message was thrown Cannot execute a data definition language command on (). The SQL database has issued an error. Problems during SQL data dictionary synchronization. The operation failed. Synchronize failed on 1 table(s) This error message does not tell you which table is failing during sync, when I checked from event log I found following error logs which tells you table name but error message was totally misleading. “Object Server 01: The database reported (session 5 (#####)): [Microsoft][SQL Native Client][SQL Server]There is already an object named '<TABLENAME>' in the database”   "Object Server 01:  The database reported (session 23 (#####)): [Microsoft][SQL Server Native Client 10.0][SQL Server]Cannot drop the table  '<TABLENAME>', because it does not exist or you do not have permission.. The S...

Dynamics AX and database synchronization error

Due to huge customization in application we may come across database and application synchronization failure issue. Sometimes you will see this error when you add some new fields in CustTable or SalesTable, this is just for an example you can have this issue in any table or view. Following job will forcefully synchronize all the tables in AOT. static void forceDbSynchronize(Args _args) {     Dictionary                             dict;     int                                        idx, lastIdx, totalTables;     TableId                                  tableId;     Application                            app...

Dynamics AX – Use definition groups to import data

It’s perfectly correct that we always learn when we want to or when we are in need of achieving goals. This happened to me for last couple of weeks when I was looking for different ways to import data in Dynamics AX 2009. I came to know that we can use data definition groups under Administration > Periodic > Data export/import > Definition groups to import data from excel or csv files. Here you can find the complete information to import data using data definition group. Any questions and comments will highly be appreciated!

Document management directory issue in AX

Question: When using document handling in AX 2009, there are 3 options: note, file, and document.  While using any one of the options I am getting the following error; "Document management directory does not exist" . Answer: Check the Document Management directory by navigating to Basic > Setup > Document management > Document types form, on the General tab in the archive directory field ensure that the path is correct as the system appears to be trying to save the document but cannot find it.

6 steps to take backup of all the objects from 'user' layer

While working on client side with lot of customizations, someone must take the backup of all the changes which already have done in an application. A very short way of taking backup from a selected layer is as follows; 1. Create a new project and open it. 2. Click on the Advance filter/Sort for this project, it will open the following screen Note: Make sure the above options should be selected for this scenario. 3. Click on ‘Select’ button. 4. Remove all the ranges from this query form and add only one range. The form will now looks like this; 5. Press OK, form will be closed 6. Press OK The new project will contains the entire objects, group by their consecutive groups.

Suppress the scaling message on AX Reports

While working on AX reports, I got a very powerful and useful feature of AX. When a report doesn't fit on a page, depending on its properties Ax will resize the report. Now AX will inform you that the report has been rescaled (Report is scaled xx percent to fit to page) and this message is generally not well received by users. Users are annoyed by the message, they get it every time they run the report, they cannot do anything about it, and they have to click to close the infolog. In order to get rid of this message on a particular report you can just modify the init() method of that report and add this line of code. this.printJobSettings().suppressScalingMessage(true); How about to cut the roots of this message and just change on one place then you can get rid of this message on all the reports rather than to go on each report and modify its init() method. Go to class SysReportRun , in the Run method, place following code before the call to super: if(t...

Financial Dimensions

Here are some useful videos which I found from Sunrise Consultants site: Financial Dimensions Overview: Definition of financial dimensions within Microsoft Dynamics AX Financial Dimensions Processing: Using the financial dimensions in Microsoft Dynamics AX Financial Dimensions Reporting: Reading financial dimensions in a report from Microsoft Dynamics AX Financial Dimensions Setup: Setting up the parameters of financial dimensions in Microsoft Dynamics AX

How to make a parameter dropdown depend on the selection of another parameter drop down

“Expressions have the solution of every problem” Let’s say you have param1 which is data bound (drop down list from dataset1), and param2 which is data bound (drop down list from dataset2). Add dataset1 Add param1 and set its values to be “From dataset” with dataset set to dataset1 Add dataset2 with a parameter dataset2_param (it could be based on a data method with a parameter param, or a query with range param), dataset2_param is the parameter you want to use to filter the drop down list of the second parameter, report parameter param will be created automatically Set param default value to be expression “=Parameters!param1.Value” Add param2 and set its values to be “From dataset” with dataset set to dataset2 Add a data region Preview

Debugging business logic in AX 2009 SSRS reports

Background With AX2009 you are now able to do SSRS reports in Visual Studio. The typical process for designing a report consist in creating a query and bind to it, code some business logic (BL) specific to the report and design the visual part. This post will focus on debugging the report business logic. For more information on designing reports in general, see the  msdn documentation You can have an idea on it from excellent post on Channel 9  here . Debugging Let say you've designed a fancy report in VS and in order to make it do cool stuff, you had to write some pretty complex business logic. Unfortunately, your business logic does not do what you think it should be doing. You know that you've been working too late on too much caffeine, so you suspect that there might be a bug there and you need to do some debugging. The 'attach-to-the-server-process' approach One approach to debug your business logic consist of the following steps · Re...