How to delete orphaned data remained from deleted company?

In AX 2009 it may happen that you delete a company but data related to this company remain in the database. You can use this script to delete this data: /* * Code Sample Disclaimer: * Microsoft provides programming examples for illustration only, * without warranty either expressed or implied, including, but not limited to,…

0

HOWTO: Print Word document from X++

You might need to print Word document directly from X++. Here’s a short sample how to do this:{ str document = “C:\\test.doc”; COM wordApplication; COM wordDocuments; COM wordDoc; ; // Create instance of Word application wordApplication = new COM(“Word.Application”); // Get documents property wordDocuments = wordApplication.Documents(); // Open document wordDoc = wordDocuments.Open(document); // Activate the…

0

HOWTO: Dynamicaly load picture from base64 string into image on form in X++

You may want to load an image from base64 coded string. Then there is a code sample how to achieve it. First is needed to put an “Window” controll on the form with name ex. “imageWindow” and then modify “run()” method of Form. String then could be loaded from database, generated by .NET (for example…

1

How to execute an external process from a batch

You might need to execute an external process in a batch and you’re thinking about using WinApi::shellExecute() method. Unfortunately the whole WinApi class is set to run on client. Also the method WinApi::shellExecute() is marked as client method. That why you can’t use this method to execute an external process from batch. How to execute…

3

HOWTO: Open AX form from custom help file.

There is one interesing feature available in help file. You could link AX Form directly from help file. There is an example in standard AX 2009 installation. Open form Accounts receivable / Setup / Customer groups. Press F1 Open file will be opened as on following picture There are a links in text as Customers…

1

HOWTO: Using WinAPI FindFirstFile, FindNextNext in Batch Jobs.

In batch job is not posible to call WinAPI functions WINAPI::FindFirstFile(..) and WINAPI::FindNextFile(…). This is limited only for code running on client. Sometimes is necesary have similar function for code running on server (or in batches). There is a code sample which is using .NET Framework. static void Job1(Args _args) { FilePath sFilePath; System.IO.DirectoryInfo di;…

1

HOWTO: Calling and using Com Connectror from VBS script.

For simple and fast testing of COM Connector you could use following VBS Script. Just copy code and paste it into file named <NAME>.vbs Dim oCom Dim sVers Dim sBuild Dim result Set oCom = CreateObject(“AxaptaComConnector.Axapta3”) oCom.Logon “”, “”, “”, “” sBuild = oCom.callStaticClassMethod(“xInfo”, “buildNo”) sVers = oCom.callStaticClassMethod(“xInfo”, “releaseVersion”) result = “Release: ” & sVers…

0

How to create a crash dump for Axapta processes ?

Symptoms: All clients lose connection to the AOS Server. If the Axapta AOS or client process crashes for any reason, it is recommended to create a crash dump, of the failing process. Here are the steps to do so: Download the Microsoft debugging tools, from here: http://www.microsoft.com/whdc/devtools/debugging/installx86.Mspx The 64-bit Version is available here: http://www.microsoft.com/whdc/devtools/debugging/install64bit.mspx Install…

4

HOWTO: Change collation of AX database?

AX databases are by default created with the same collation as your SQL Server has. But time to time you might need the database to have different collation. Maybe you think you can just execute ALTER DATABASE statement to change database’s collation but this won’t help. It is necessary to take in account that also…

1

HOWTO: Sending mail from AX using .NET Framework.

Sometimes happen that SysMailer class (using CDO) is not the right solution for sending mails with attachments. There is a little sample of X++ Job that is using System.Net.Mail namespace to achieve same. static void JobNETSendMail(Args _args) { System.Net.Mail.MailMessage mailMessage; System.Net.Mail.Attachment attachment; System.Net.Mail.AttachmentCollection attachementCollection; System.Net.Mail.SmtpClient smtpClient; System.Net.Mail.MailAddress mailAddressFrom; System.Net.Mail.MailAddress mailAddressTo; str strBody; str strSMTPServer; str…

2