Posts

Showing posts from 2009

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() { super(); TempTable.setTmpData(tmpTableClass::populateTmpData()); }

Send email by using SysMailer

There are several methods to send email in Axapta. Using SysMailer is one of those. Method 1 (Normal): static void Email1(Args _args) { SysMailer mailer = new SysMailer(); ; mailer.quickSend("mike@abc.com","mike@abc.com","subject","body"); } Method 2 (Simple): static void Email2(Args _args) { SysMailer mailer = new SysMailer(); SysEmailParameters parameters = SysEmailParameters::find(); ; if (parameters.SMTPRelayServerName) { mailer.SMTPRelayServer(parameters.SMTPRelayServerName, parameters.SMTPPortNumber, parameters.SMTPUserName, SysEmailParameters::password(), parameters.NTLM); } mailer.fromAddress("mike@abc.com"); mailer.tos().appendAddress("mike@abc.com"); mailer.htmlBody("hi"); mailer.sendMail(); }

Post packing slip of sales order in X++

SalesFormletter SalesFormletter; SalesTable SalesTable; ; SalesFormletter = SalesFormletter::construct(DocumentStatus::Confirmation,true); SalesTable.clear(); SalesTable = SalesTable::find(_salesId); SalesFormletter.update(SalesTable, systemDateGet(), SalesUpdate::All, AccountOrder::None, false, false);

GetSystemDateTime() difference

Situation: I tried to update a datetime value of a external database to let say GetSystemDateTime(). However, it was found that the time updated was not equal to GetSystemDateTime(). Solution: It is because of time zone problem. In AX 2009, datetime is stored in UtcDateTime format. During presentation, the offset timezone of the user option is calculated. So you can make use of the following code to update datetime DateTimeUtil::applyTimeZoneOffset(datetimeutil::getSystemDateTime(), DateTimeUtil::getUserPreferredTimeZone());

How to post purchase order packing slip with WMSJournalId

I was requested to post the packing slip of purchase order automatically after post the item arrival. Below is the main code to post packing slip with WMSJournal void SIT_Post_PurchFormLetter_PackingSlip(WMSJournalTable _WMSJournalTable) { PurchFormLetter_PackingSlip purchFormLetter_PackingSlip = PurchFormLetter::construct(DocumentStatus::PackingSlip); ; purchFormLetter_PackingSlip.SIT_ParmWMSJournalId(_WMSJournalTable.journalId); purchFormLetter_PackingSlip.transDate(today()); purchFormLetter_PackingSlip.update(_WMSJournalTable, _WMSJournalTable.JournalId, today(), PurchUpdate::Recorded); }

How to reverse packing slip of Purchase Order or Sales Order

It can be done by use "Delivery now" or "Receive now" in the quantity tab of sales order and purchase order form. http://daxfaq.studioerudit.com/#post3

Google Chrome Extensions

Google Chrome extensions officially launched. (but still in beta) You can find extensions in the following website: http://www.chromeextensions.org/ https://chrome.google.com/extensions

How to Delete All Transaction and Keep Master Setup

You can run class  SysDatabaseTransDelete to delete all transactions.

Table Synchronize Error

During the customization of AX 2009, I always get this error prompt out when modifing table, index, EDI or even compile the whole AOT: Cannot execute a data definition language command on ().The SQL database has issued an error. It told neither what table nor index have error. Finally I found a job which can tell you what table cause the synchronization error. static void SIT_ForceDbSynchronize(Args _args) { Dictionary dict; int idx, lastIdx, totalTables; TableId tableId; Application application; SysOperationProgress progress; StackBase errorStack; ErrorTxt errorTxt; ; application = new Application(); dict = new Dictionary(); totalTables = dict.tableCnt(); progress = new SysOperationProgress(); progress.setTotal(totalTables); progress.setCaption("@SYS90206"); errorStack = new StackBase(Types::String); lastIdx = 0;

How to Reinstall or Repair IE6 and IE7

Internet Explorer can and does break. It is usually the result of some addon or Spyware that has been removed and has broken a key element of the popular browser. By now, most people should have already upgraded to IE7--especially if Automatic Updates are turned on. In fact, IE8 will soon be rolling out, and the versions since IE6 are more secure and easier to repair than the old, abandoned version 6. No matter which version you're using you should always have the capability of repairing or reinstalling the browser. In the case of IE6, you might need your Windows CD. Reinstall IE6 There are some cases where it is necessary to keep Internet Explorer 6. This is normally in corporate environments where compatibility is an issue. In this case, you can reinstall IE6 by going to Start>Run and typing %systemroot%\inf . Hit OK and then you should be able to scroll down until you find IE (or IE.inf). Right-click and select Install. You may be asked to insert your Windows CD at this

Count Distinct in Excel

To count the distinct value of a list of data, you can try the following functions (Assume the data are in A1:A30000, you cannot use A:A in this function): =SUMPRODUCT((A1:A30000<>"")/COUNTIF(A1:A30000,A1:A30000&""))

SQL Server 2005: MUST_CHANGE is ON

I have created a SQL user, but it force me to change to password. I go to the SQL Server Management Studio and untick the Enforce password policy. However it prompt the following message: The CHECK_POLICY and CHECK_EXPIRATION options cannot be turned OFF when MUST_CHANGE is ON (Microsoft SQL Server, Error: 15128) A SQL query can solve the problem ALTER LOGIN (Username here) WITH PASSWORD = '(Password here)'

AX 2009 enum DateFlags error

Situation: When you compile the AOT, you got a error which said enum DateFlags not found. Solution: Probably the problem was in different version of client and AOS. Client was AX 2009 without SP1. After installation of service pack on client machine. The compilation was OK.

Add a new inventory dimension

Dynamics AX 2009 includes the following inventory storage dimensions from the packaging: Warehouse Batch number Location Pallet ID Serial and item dimensions: Configuration Color Size Sometimes it may not be enough for the business needs. To add a new dimension, you can follow the steps below: First, I assume you have create the dimension tables (similar to InventColor, InventBatch) Add the key field into the table InventDim. Then add to the field group InventDimensions and InventoryDimensions Add fields to the DimIdx as well as relations if necessary. And then modify some methods if InventDim, just goes thru all methods. Add fields to InventDimParm also. Modify macro InventDimJoin and InventDimSelect. The most important things is do a seach at the top of AOT with #InventDimDevelop as the keywords. Do a complete Recompilation of all stuffs. Finish! You are suggested to add all new dimensions before the system implementation. If there's some open transaction, we