WINDOWS Live Search

To contact me for any clarifications regarding any posts / information, please mail me at arijit [dot] basu [at] gmail [dot] com

Saturday, December 30, 2006

Dynamics AX 4.0 - Smart customizations

This 30 minute talk by MFP explains how you can customize the business logic in Dynamics AX 4.0, in a way that makes future code upgrades easier.

Click here for the link

Friday, December 29, 2006

Wish Everyone a Happy New Year, and a Great 2007!

Tuesday, December 26, 2006

COM Wrapper Wizard in DAX 4.0

The COM Class Wrapper Wizard is a great utility in DAX 4.01 which helps you create COM Wrapper Classes easily. Apart from the basic Type Libraries available from the Wizard, you can also create your own DLL and use this wizard to interface from DAX.
Ive created a simple DLL (Click here for the Link) , registered it on my PC, used this Wizard to create wrapper class inside AX. Its simple to do :)

A Small Job :) The Celsius / Fahrenheit conversion logic is in my customized DLL :)

DAX 4.01 Enterprise Portal

The DAX 4.01 EP was much awaited as it was based on MS SPS, giving user more flexibility. Ive managed to set up the EP. Folks may get errors while settin it up, but there's a good document on Partnersource which will help you a lot. Remember you gotta enable ASP.NET 2.0 first (ASP.NET v2.0.50727).
Looks kewl..... :)

Sunday, December 24, 2006

Merry Christmas

Wishing everyone a Merry Christmas :)

Saturday, December 23, 2006

Microsoft Dynamics AX 4.0 Service Pack 1 release

Download Microsoft Dynamics™ AX 4.0 Service Pack 1 (SP1), the current release of Microsoft Dynamics AX.

Microsoft Dynamics AX 4.0 Service Pack 1 (SP1 - Localized) is the latest version available. SP1 is a full install and recommended for new installations or upgrades from previous versions.

Note: This download has been updated with additional languages since it was first posted.

Click here to download { Requires partnersource Logon }

Demo Data for Microsoft Dynamics AX 4.0

The Demo Data set for Dynamics AX 4.0 is based on the Global Trade and Manufacturing Company (GTM), a fictitious U.S. based midsized trade and manufacturing company headquartered in Los Angeles. GTM produces and assembles lamps and lamp parts, and trades with customers and vendors in Europe and the U.S. working with relevant currencies.

Click here to download {Requires Partnersource Logon}

Monday, December 18, 2006

TODO : I gotta do this later :)

Sometimes we have to write some code at a particular place, but not quite sure or something that will have to be added later on. In order to remember the place and what to do, you can use the TODO word. Put this piece of Code where u want to put some code later.

//TODO: I Have to relook at this code --> ARIJIT

On the Complier, this appears on the Tasks Tab of the Compiler.

See Screenshot below.

How to enable Best Practices in DAX

DAX 4.0 comes with ZERO BP errors. Heres how to enable the BP in DAX so as to make your codes BP Complaint.

From the Compiler, Click Setup>Compiler

A Form opens up. Select Diagonistic Level to 'Level 4'. By default its 'Level 3'.Click apply after selection.

Now again from the Compiler, Click Setup>Best Practices. A New Form opens up. Check all the BP rules that you want to apply. Click Apply after Selection.

Now Close the Compiler and Now Compile your Project/Developement and on the BP tab of the Compiler you can see your BP Violations. The Objective is to reduce them to ZERO.


DAX 3 menu in DAX 4

Below are the steps to show the DAX 3 Menu in DAX 4.0. Remember you cannot change the DAX 4.0 Navigation Pane but you can create a similar toolbar :)

On the Clicked Method of the Menu Icon (Its actually a button with Image Only Property), add the following code

void clicked()
Menu stdMenu;
stdMenu=infolog.findNode(#MenusPath + #AOTDelimiter + menustr(mainMenu));

You will get the Old menu :)

You can also add this code to the Startup method.
However the DAX 4 Menu is much better :)

Sunday, December 17, 2006

Automatically update a form after a time interval

At times, you may want a form to be automatically updated at a certain time interval, for example if the data displayed in the form frequently changes or you would like to execute a task from a form at certain time intervals.
All forms inherit properties from the Object kernel class. The SetTimeOut() method is located in this class.
This method is used with three parameters,the first two of which are mandatory.

- The first one indicates the ID of the method to be activated.
- The second indicates the number of thousandths of seconds for the method, specified in the first parameter that is executed.

- The last parameter is a boolean that is used to indicate how the time is measured.

If the parameter is set to true then the idle time is measured from when the keyboard or mouse was used. Use false to indicate that the time should be measure since the last time SetTimeOut() was executed.

You can execute this method from a form with the code:


Saturday, December 16, 2006

Confirmation Box when Sending E mails from AX

We often get this MS Outlook prompt when we send email from AX...
There is a Utility which automatically clicks the Yes Button. The Name is ClickYes.

Heres the download link.
Its kinda nice.Check it out...

Upgrading Microsoft Dynamics AX 4.0 to Service Pack 1

If you are familiar with upgrading from earlier versions of Microsoft Dynamics AX, you should be aware that the upgrade scenarios to Microsoft Dynamics AX 4.0, and from Microsoft Dynamics AX 4.0 to Microsoft Dynamics AX 4.0 with Service Pack 1, differ from previous scenarios. A whitepaper is available at Partnersource which describes the steps in upgrading DAX 4.0 to DAX 4.0 SP1.

Click Here for the link {Requires Partnersource Logon}

Thursday, December 14, 2006

Thanks Microsoft Dynamics AX

I thank Microsoft for putting the link to this BLOG on their Dynamics Communities Landing Page on the Microsoft Site.

Click to go to the Dynamics Communities Landing Page on the Microsoft Site

Wednesday, December 13, 2006

How to call external dll files from AX

This is how u can call a dll from AX. I have used the Beep function in kernel32.dll
The parameters of Beep are

BOOL Beep(DWORD dwFreq,DWORD dwDuration);

To get more information on Beep Click here

The AX Code is

static void AB_DLL(Args _args)
DLL winApiDLL = new DLL('kernel32');
DLLFunction Function = new DLLFunction(winApiDLL,'Beep');


Run this and u'll hear a beep (if ur sound is on).

Standard Benchmark on Hewlett-Packard Proliant Servers for Microsoft Dynamics AX 4.0

In August 2006, Microsoft Corporation conducted the Microsoft Dynamics AX™ 4.0 Standard distribution benchmark to measure the performance and scalability characteristics of Microsoft Dynamics AX 4.0 in a simulated distribution scenario. This benchmark exercised core Accounts Receivables scenarios around order entry through invoicing, in addition to Procure to Pay processes around purchase order creation through receiving of goods.

Download White paper {Requires Partnersource Logon}

Microsoft BizTalk Server and Microsoft Dynamics AX

Microsoft BizTalk Server and Microsoft Dynamics AX: Integration Solutions for the Extended Enterprise White Paper

Large organizations struggle to maintain a balance between centralization in order to control system and information complexity across the extended enterprise and decentralization in order to encourage flexibility and agility among local subsidiaries or divisions. Through deployment of Microsoft Dynamics™ AX and Microsoft® BizTalk Server, enterprises can realize not only a simple, high-value solution that offers visibility, insight and control of information across the entire organization, but also the flexibility and agility that branch offices and subsidiaries require in order to innovate, grow, and compete effectively. This white paper will be of interest to the business decision maker who is looking to find a robust, high value solution that provides cross-functional integration and coordination of business applications and supply chain management applications across the extended enterprise.

Download the white paper {Require Partnersource Logon}

Rapid Configuration Tool for Microsoft Dynamics AX 4.0

The Microsoft Dynamics AX 4.0 version of the Rapid Configuration Tool is now available. This version of the tool builds on the previous two versions and works with the latest release of Microsoft Dynamics AX 4.0.

Download Rapid Configuration Tool (RCT)

The Rapid Configuration Tool (RCT) for Microsoft Dynamics AX 4.0 is a tool that supports both partners and customers in the implementation and configuration process by providing and linking project management features, easier configuration access, communication support and documentation on how to configure Microsoft Dynamics AX. The Rapid Configuration Tool consists of functionality implemented as a module within Microsoft Dynamics AX.

{Requires Partnersource Logon}

Tuesday, December 12, 2006

Exporting Table field data to excel

Ive used EmplTable and have exported EmplId & Name. You can extend this :)

static void ArijitExcel(Args _args)
EmplTable EmplTableLocal;
SysExcelApplication excelApp;
SysExcelWorkSheet excelWorksheet;
SysExcelRange excelRange;
SysExcelCells excelCells;
SysExcelCell excelCell;
ComVariant cellValue;
Int i=1;
excelApp = SysExcelApplication::construct();
cellValue = new ComVariant() ;
excelWorksheet = excelApp.worksheets().itemFromNum( 1 );
excelCells = excelWorksheet.cells();
while select * from EmplTableLocal


Super() is a call to the overriden method concerned in the super or parent class.

For the click event it does not serve any purpose since there is no change in functionallity if you remove it and you will not get any error.

For example:

if you create a class myCLASS1 and then inherit from it and override a method on it the call to super will execute the code from the inherited class.

If you remove super that code will not be executed and you may write different code for this method in the child class.

Simple :)

Missing axsysen-us.ktd text file :(

Sometimes when Launching AX, we get an error as shown below :

"Microsoft Business Solutions-Axapta installation has no text file (axsysen-us.ktd)"

The problem is with the ACU config file in the bindir textbox, on the following line:

bindir,Text,C:\mbs\axapta server\Bin

So change this to:

bindir,Text,C:\mbs\axapta client\Bin

The Ktd files live in the \Bin\ folder instead of the \Appl\ folder.

This will resolve your issue :)

Monday, December 11, 2006

Knowledge Portal for our MS Dynamics Team

The last few weeks were kinda very busy for me as i was responsible for puttin together our team KM Portal. Being a MS freak and since DAX 4 EP is on MS SPS2003 , I decided to go ahead with MS SPS 2003 SP2 and finally it went live today. Here's the home page.

Thursday, December 7, 2006

Creating a MS Word Document from X++

Heres the Code :)

COM wordApplication;
COM wordDocuments;
COM wordDocument;
COM wordRange;
wordApplication = new COM("word.application");
wordDocuments = wordApplication.Documents();
wordDocument = wordDocuments.add();
wordRange = wordDocument.range(0,0);
wordRange.insertafter("Arijit Basu");
wordRange = wordDocument.range(6,19);

wordRange = wordDocument.range(11,26);

Wednesday, December 6, 2006

Holiday season X++ Crossword from MFP

A small challenge for the DAX lovers . MFP has created reated a small crossword using X++ system functions .
The prize is: One copy of "Inside Dynamics AX" - signed by the authors.

Please go to Blog of Michael Fruergaard Pontoppidan {MFP} link to answer this crossword :)

Last date is 20th Dec 2006.

The coveted Gold Certified Partner award

Me holding the coveted award :)

Use pack/unpack on Form

If you want to implement the pack/unpack mechanism on the Form {like the ones used in Runbase Classes} , it is easy ...

Besides Pack/Unpack, add these methods:

public dataAreaId lastValueDataAreaId()
return curExt();

private UserId lastValueUserId()
return curuserid();

private UtilElementType lastValueType()
return UtilElementType::Form;

private IdentifierName lastValueElementName()

private IdentifierName lastValueDesignName()
return '';

void initParmDefault()

In Close method of the form:
public void close()
//add saveLast method after super()

in init method of the form:
public void init()

//Add getLast method before super()


Monday, December 4, 2006

Dynamics AX Consultant Toolkit

The Consultant Toolkit for Microsoft Business Solutions–Axapta®, now a part of Microsoft Dynamics, includes: step-by-step methodologies, project tools, templates, delivery guides, and packaged service offerings (QuickStart and QuickPlan for Microsoft Business Solutions-Axapta).

DAX Consultant Toolkit { Requires Partnersource Logon }

Its a very good resource for DAX Professionals, DAX Project managers and has tons of useful stuff , templates etc. Worth checking out.
Hope you like it :)

Industry solutions for Microsoft Dynamics AX

The Microsoft Industry Builder initiative is a structured program in which Microsoft works together with select independent software vendors (ISVs) to deliver complete, top-quality solutions that meet the unique needs of different industries. Microsoft Dynamics AX software solutions that are developed through this program meet Microsoft's strict quality standards and are packaged with a Microsoft-backed customer support offering. Check out just some of the benefits below that the program offers.

Industry solutions for Microsoft Dynamics AX

A Brief History of DAX

When Axapta®, now Microsoft® Business Solutions–Axapta { Microsoft Dynamics AX}, was released in 1998, it brought an exciting new object-oriented technology within reach of midsize companies that needed a powerful, scalable business management suite to run their operations. The new solution featured advanced ideas and technology such as:

* Multilanguage, multi-country capability
* Auto size (IntelliMorph), for easy customization
* Feature keys, for easy upgrades
* No fixed numbers
* Keep information stored in one single database
* Separate user interface, business logic and database (3-tier)

Since the release of Axapta 1.0, the solution has expanded dramatically in scope and capability. Read below for a brief history of major releases, as well as the core technological advances.

Axapta 1.0 - March 1998
· Released in the US and Denmark
· Financial, trade, inventory management, logistics and production, Microsoft SQL Server 6.5
Axapta 1.5 - November 1998
Early release in Norway, Sweden, Germany, UK, Netherlands, Austria, Switzerland, Belgium Spain and the European Union
Publishing Manager, call COM, Service Pack technology, Microsoft SQL Server 7.0
Axapta 2.0 - July 1999
Project Accounting module, WMS, External OLAP, Option Pack concept, ActiveX support, COM-connector and an early release of Axapta Object Server
Axapta 2.1 - January 2000
Market demands from Germany, Austria, Switzerland and Spain
Web tools and CSS (The first WebApp), Microsoft SQL Server 2000, database log
Microsoft Windows 2000 logo
Axapta 2.5 – December 2000
Complete Web applications development environment
Auto upgrade tool, ESS (Project), Banking, First step of Load’n’Go, OLAP within Axapta, XML support, FA to Denmark, Austria and UK
Domains and ASP support, DBCS Support
Axapta 2.5 Market Pack – October 2001
Released in France and Italy
Marketing Automation (CRM), Commerce Gateway, Product Builder (Web application as well), training and Event Management (Web application as well)
Microsoft Axapta 3.0 - October 2002
Microsoft Axapta Enterprise Portal, intercompany collaboration
New security and configuration keys
Expanded geographical reach (more countries)
Demand planning
Enhanced partner productivity tools

The above history is obtained from Partnersource. heres the link...

A Short History of DAX

Sunday, December 3, 2006

Microsoft Dynamics AX Demos

Wonderful AX Demos available at this link
Its a absolute must see for all DAX folks

Registration required (I've got mine and its kinda good, but a bit slow. You need a very good Internet connectivity. Good stuff though.)

The Architecture Journal

The Architecture Journal brings together some of the best thinkers in the industry, and their articles have covered a variety of highly relevant topics for the software industry.
Its a must read for every Tech Savvy guy/gal :)

Its top level thought from some of the worlds greatest brains.

Microsoft Dynamics AX 4.0 / SP1 Downloads

Microsoft Dynamics AX 4.0 Download

Dynamics AX 4.0

Microsoft Dynamics AX 4.0 Service Pack 1 release

Dynamics AX 4.0 SP1

{The above links require Partnersource Logon}

Saturday, December 2, 2006


Aggreg8 is a social networking and collaboration space for the IT community. Inside you can keep track of your trusted network, find others through your network with similar interests or situations.

Definitely worth checking out.....

DAX System tables

DAX system tables contain data that the DAX kernel uses to control the behavior of the kernel. DAX system tables are created automatically by the kernel when DAX is started for the first time against an empty database or after a service pack upgrade.


This table contains info about explicit granted access rights for the defined user groups.

This table contains relation between companies and domains.

This table contains data about created companies.

This table contains data about which tables and events to log. The events are logged in the DAX tableSysDatabaseLog.
This table contains data about domains.
This table is used in connection with printing from DAX.
This table is used in connection with printing from DAX.
This table is used temporarily during check / synchronisation process and should normally be empty.
This table contains data dictionary data about DAX application and system tables (except SQLstemVariables) as stored in DAX data dictionary.

This table contains license information, version, feature key setup, and other basic system configuration data.

Table describes relation between users and user groups.

Table is used to store general setup.

{Please use them with utmost care}

Sending emails directly from PO/SO

One of my clients wanted a solution where by he could notify/e mail employees/members/groups directly from PO & SO. So I came up with a small utility which allowed a user to notify directly from PO & So Forms via e mail.
Happy mailin :)

Temporary tables

Temporary tables are used for non-persistent storage in Microsoft Axapta.
They are useful in two common situations
1. As the datasource for a form or report, where the original data is too complex to be easily queried.
2. As temporary storage during complicated processing, to hold the results midway through the process.
Scoping rules for temporary tables
In general, each instance of a temporary table, and it's associated data, will only exist while the buffer variable used to access it is in scope.
You can point multiple buffer variables to the same instance of a temporary table by using either the .setTmpData() method or by directly assigning the buffers to each other, identically to normal tables. In this way, even if your original buffer variable goes out of scope, your data will be retained while one of the other referencing variables remains.
Be aware that static table methods - such as find() - will not work with temporary tables unless you pass through the buffer variable to the method.
For example, this method will not work on a temporary table, as the tempTable variable used is newly created and will always contain no records.
public static TempTable find(AccountNum _accountNum, boolean _forUpdate = false)
TempTable tempTable;

if (_accountNum)

select firstonly tempTable
where tempTable.AccountNum == _accountNum;

return tempTable;
If you want to have a find() method on your temporary table, then you will need to modify it slightly to pass through a reference to our populated temporary table.
public static TempTable find(AccountNum _accountNum, TempTable _tempTable, boolean _forUpdate = false)

if (_accountNum)

select firstonly _tempTable
where _tempTable.AccountNum == _accountNum;

return _tempTable;
Some examples of populating and using temporary tables can be found in project.
Creating temporary tables
In the AOT
Set the Temporary property to Yes to create a table which will always be temporary.
Note that any existing data will be permanently deleted if you do this!
Of course, you can no longer use the Table Browser to check the data, as the data is stored only per scoped instance of this table.
Making an existing table temporary
You can convert a normal table to a temporary table in code. For example, if you wish to create a temporary copy of the inventory table:
InventTable inventTable;

Doing so will remove all data from the temporary copy of the table. If you wish to create a populated temporary copy of a standard table, you can do the following:
InventTable inventTable;
InventTable inventTableTmp;

while select inventTable
You can now add, modify or delete data from the table without affecting the real contents stored in the database.
Temporary tables in forms
Using temporary tables in forms requires the use of the .setTmpData() method.
For example:
The temporary table data is populated in a static class method (running server side), which is called from the form and returns the populated table. We could populate a form-level buffer with the temporary data if needed, or else just call the populating method directly from the setTmpData() call as shown below.
In the form datasource init(), we use .setTmpData() to instruct the datasource query to use our temporary table. Our datasource name in this example is TempTable.
public void init()


Temporary tables in reports
The correct method of using temporary tables in reports is slightly different from that of forms.
The most important difference is the use of .setRecord() instead of .setTmpData(). A simple example follows:
public boolean fetch()
boolean ret;


ret = super();

return ret;
As there is often already a supporting RunBaseReport class being used to run the report, it is easy to integrate the population of the temporary data into that existing class. This is particularly useful if you need the data in the temporary table to be dependent on information entered into the report dialog prompt by the user.

Friday, December 1, 2006

How to create a new Ledger Journal Type in AX

Recently I came across a situation in AX where I needed to capture a lot of Information in Journal Trans form for a specific journal type and while posting the Journal, those data needed to be updated in a separate table. So instead of working with the base Ledger Journal Types, I found it convenient to create a new Ledger Journal type. The objects used are shown below. In case further info is required, lemme know :)
In case u have a better idea, also lemme know :-D

Happy Journaling.....
You can also extend this model to create your own posting profiles [I'm recently workin on tat :) ]

Tuesday, November 28, 2006

How to create a Checklist in DAX

Hi , Its kinda simple to create a Checklist in X++ , just like the sysStartup Check List. Attaching the screenshot n objects used. In case anyone wants the XPO, lemme know.

Sunday, November 26, 2006


Recently i got an error when I installed DAX 3.0 SP5 on a fresh PC when it was compiling for the first time. The error screen is shown below. I downloaded the latest GridEX20.ocx from

Replaced in the Client/Bin Folder . The error vanished :-)

An error log was generated in MyDocuments Folder :-(

Replace the GridEX20.ocx and enjoy :-)

Saturday, November 25, 2006

Axapta Web Deployment

With Web Deployment, the user executes, deploys, and installs the Microsoft Axapta client using Microsoft IE. The user can easily see if they need to install or update the client or if the client is ready to run. Web Deployment also allows you to use a central configuration for all Microsoft Axapta users, making it easy for you to change parameters without going to each client workstation. The Flowchart for this process is attached below. Last month I did this for one of my clients and came up with a jazzy web page. For more details, you can mail me...

Friday, November 24, 2006

Caching in Axapta...

In Microsoft Axapta 3.0, there are three cache mechanisms:

1. the single record cache,
2. the entire table cache, and
3. the record view cache.

Record Caching
The record cache is utilized for full key lookups only and contains the 100 most recently used records for a particular table. In a 3-tier environment, there is a record cache on the client and a record cache on the server. The server record cache is shared between all clients.
Record Cache are of the following types:
(a) NotInTTS
(b) Found
(c) FoundAndEmpty

Entire Table Caching
The entire table cache is a different type of caching compared to record caching,which is a complete local copy of a table. The entire table cache exists on the AOS, a 3-tier rich client, the COM connector, and on a 2-tier client. This
means that there is no entire table cache on a 3-tier thin client, as it utilizes the entire table cache located on the AOS.
The cache is populated at the time of the first access to that particular table for a given company.

Record View Caching
The RecordViewCache is instantiated using a X++ select with a where clause that defines the result set. The RecordViewCache is deactivated as soon as the RecordViewCache object goes out of scope or is destroyed.
It is private and offers a result-set cache with a limited lifetime.

How to find out where that error message comes from?

Wanna find out where the error message comes from? Heres the secret.... Place a breakpoint in the class \Classes\Info\add(). After that run the script that shows error. You can observe where the error comes from in the DAX Debugger :-). See the following screenshots.......

Thursday, November 23, 2006

Setting up the TAPI interface in Axapta

What is TAPI
TAPI (Telephony Application Programming Interface) is a Microsoft Windows standard interface for integration between telephone systems and windows based software. A typical example is integrating called ID with a database on your computer that contains detailed information about potential callers. When your phone rings, a window pops up
on your computer with information about the caller. This is possible through software applications that are TAPI compliant and support the Screen Pop and Auto-Dialer capabilities.

To be able to use the TAPI interface, you have to install a TAPI CT adapter. The adapter have to support the telephone you are using, and in many cases it would be preferred to buy the adapter from the same producer as your phone.When the adapter is procured, follow the instructions and install the TAPI driver on your computer.

Setting up the TAPI interface
Setting up the TAPI interface involves the following steps:
• Set up Microsoft Windows to handle your TAPI driver
• Select and set up TAPI in Axapta CRM.

Setting up Microsoft windows for TAPI adapter
1. From the Windows start menu, select Settings/Control panel. Open the Phone and Modem Options.
2. When standing in the Dialing rules tab, press the Edit button.
3. Fill in the Edit Location form, press Apply, and click OK when finished.
4. Click on the Advanced tab, and then click Add. The new device will then appear in the Add provider window. Select the driver you have installed for your TAPI adapter,and click Add.
5. A new window will now appear, and you must select which com-port to use.
6. Close the Phone and Modem Options.

Setting up Axapta CRM for TAPI adapter
1. Start Axapta and select CRM.
2. From the main menu select Sales force automation/Setup/Telephony/Phone parameters.
3. Delete all lines in the Phone parameters window, and shut down Axapta.
4. Restart Axapta and select Sales force automation/Setup/Telephony/Phone parameters from the main menu.
5. In the Phone parameters window select the line device provider you are using, click on the Set active line device button, and restart Axapta.
6. When restarted select the Sales force automation/Setup/Employee option. Select employee and go to the Telephony tab and check the Activate answer checkbox.This will make the telephone dialog pop on your screen each time you receive a call.

How to post SO's or PO's with X++

If you need to update a sales order or a purchase order without any user dialogs, Axapta provides you with a simple interface to do just that.The SalesFormLetter and PurchFormLetter classes contain the update method, which gives you an easy interface to setup and run posting of a sales order or a purchase order.

static void postSalesFormLetter(Args _args)
SalesFormLetter salesFormLetter;
salesTable salesTable;


while select salesTable
where salesTable.DocumentStatus == DocumentStatus::Invoice &&
salesTable.SalesId == 'SO/07/123' // Select the SO Number
salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice); // Get a new instance of SalesFormletter
salesFormLetter.transDate(SystemDateGet()); // Set the invoicedate
salesFormLetter.update(salesTable, // SalesTable
SalesUpdate::All, // Quantity to update (SpecQty)
AccountOrder::None, // AccountOrder
false, // Proforma only?
true); // Printout?

How to Create Global Functions in X++

In order to create Global functions, create a new method in \Classes\Global Node. I have called mine Print Name.


The Code in Print Name () is shown below

static str PrintName(Str FName,Str LName,Str MName="")

Return Fname+". "+Mname+". "+Lname;
Return Fname+". "+Lname;

And you've just created a global method :-)

Now Execute this job:

static void GlobalMethod(Args _args)

The Output:

Send E Mail from Axapta

SysMailer mailer = new SysMailer();
SysEmailParameters parameters = SysEmailParameters::find();
mailer.subject('What are you doing tonite???');
if (parameters.DNSServerName)

if (parameters.SMTPRelayServerName)

// Add your own code here, then send the message


SysMailer mailer = new SysMailer();
mailer.body("My Body :)");
mailer.subject("WOW Baby");
mailer.fromName("Peter Villadsen");

SysINetMail Mail=new SysINetMail() ;
"My Body Text ;-)",
"Attachment Path");

All the Best :-)
Happy Mailin...

"Journal Name may not be changed when vouchers have been created." error message when entering General Journal

The particular number sequence can be found by:
1. Click General Ledger, click Setup, click Parameters and then look on the Number Sequence Tab. The Number Sequence you will be looking for will be the Number Sequence for Journal.
2. Right-click in the Number Sequence Code column and select the Main Table.
3. In the Number Sequence Window, click the List Button and delete any lines out of the window to correct the issue.

How to get quantity on hand for an item?

InventDim inventDim;

InventSum inventSum;
InventQty inventQty;
while select sum(postedQty), sum(received), sum(deducted), sum(registered),

sum(picked), sum(reservPhysical)
from InventSum group by itemId
join InventDim
where inventSum.inventDimId == inventDim.inventDimId &&
inventSum.itemId == 'A001' &&
inventDim.inventLocationId == 'GW'
inventQty = inventSum.PostedQty+inventSum.Received+inventSum.Deducted-

info(strfmt('%1', inventQty));

How to create a PO from AX Classes

static void createPurchase(Args _args)
AxPurchTable table;
AxPurchLine line;
table = new AxPurchTable();
line = new AxPurchLine();
line.itemId('A001'); // Item number Q987
line.purchQty(12); // 12 pcs.;

Using colours in grids cells

Highlighting complete rows

The method .displayOption() method on a form datasource can be over-ridden to control the appearance of an single row in a grid. It is possible to set the background or foreground (text) colour.
public void displayOption(Common _record, FormRowDisplayOption _options)
_options.backColor(WinApi::RGB2int(255,255,0)); // Yellow

Highlighting individual grid cells

To highlight one or more individual cells, use the ._options.affectedElementsByControl() method to limit the effect to only the cells in which you are interested.
Note that while this method can display the same colour in multiple cells, there is no way to display different colours in a single row.
public void displayOption(Common _record, FormRowDisplayOption _options)
_options.backColor(WinApi::RGB2int(255,255,0)); // Yellow

Creating a node using X++

static void Createquery(Args _args)
// This function will add a new Form to the AOT.
treeNode treeNode;
xInfo xInfo = new xInfo();
treeNode = xInfo.rootNode();
treeNode = treeNode::findNode("Forms");

Multiple form opening from same button using X++

void clicked()
Args args = new args(); ;
switch (Parameter.text())
{ case '10001' : new MenuFunction(MenuItemDisplayStr(ParameterClass), MenuItemType::Display).run(args); break; case '10002' : //call appropriate menu item here break;

Updating external database using X++

loginProperty loginProperty = new LoginProperty();
ODBCConnection odbcConnection;
Statement sql;
ResultSet result;
odbcConnection = new ODBCConnection(loginProperty);
if (odbcConnection)
sql = odbcConnection.createStatement();
result = sql.executeQuery("select * from table");
while (
print result.getString(1);