Create Delete Actions through code in AX

Hi Folks, It has been a long time, since I have posted any blog because of my busy project schedule…………. In this post, I am going to discuss on how to create delete actions through code in AX. Let us create a delete action in InventTable for a testTable. SysDictTable table; Treenode treeNode, datreeNode; table…

Get all Error Messages of Infolog in the desired language into a string and return it to external application

If you want to get all the error messages in the infolog in a desired language then just put this small code snippet and run it in a job. infolog.language(LanguageId); then whole UI of AX Client will be changed to the desired language and we will get the error messages into the infolog in that…

Insert / Delete / Update records into an external SQL database from AX using x++

Inserting/Deleting/Updating records into an external SQL database from AX 2009 using x++ can be done using ADO Classes in AX. This can be told from the following code snippet. In the below code snippet CCADOConnection is used to establish a connection with the external database and CCADOCommand is used to execute the command on the…

|

Paging in a Query(Query run)/Paging while retrieving the records from a query

Today, I have a found a new function in QueryRun class and thought of sharing it here in this post. Its use can be found while integrating AX with some external applications. I am sure that everyone has used queryrun class in x++ code. I have found out a special function in QueryRun Class with…

|

Convert pdf or any type of file to base 64 string in AX using x++

Here is a code snippet to convert any file into a base64 string in x++ using some dot net inbuilt classes in AX. To convert it, initially clrinterop permission must be granted to access the dot net inbuilt classes then load the file into file info, initialize the byte array with the length of file,…

|

Store and retrieve an image in a table for a record in AX

The simplest way to store an image for a record into AX tables is by using the CompanyImage Menu Item. I will explain you with an example below: Generally, most of the customers would request for a functionality to store an image for an item. For this, there is no need of high customization. Initially,…

|

calculate total sales order or sales quotation amount / discounts / tax etc., through code( X++ ) in AX

I have seen that few developers have a problem in getting the total Sales order amount or sales quotation amount with Tax /discounts etc., in the preferred currency before invoicing because these are not stored into any specific tables. The below form shows, where we can see the sales totals, Accounts Receivable->Sales Order-> Inquiries Menu->Totals…

|

Print Sales Invoice Report in PDF / HTML / RTF / ASCII etc., format through code

I have observed that lot of developers face difficulty in printing the Sales Invoice report into file system through code. Here is the code snippet for it. SalesFormLetter salesFormLetter; PrintJobSettings printJobSettings; CustInvoiceJour custInvoiceJour; SalesId salesId; #File salesid = “SO-100010”; salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice,false); printJobSettings = new PrintJobSettings(); printJobSettings.setTarget(PrintMedium::File); printJobSettings.format(PrintFormat); printJobSettings.fileName( ‘//10.0.57.22/AOSPrintShare//’ + salesId+#pdf ); printJobSettings.warnIfFileExists(false); SalesFormLetter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings());…

|

send e-mail through code with attachments in AX

1. To send an email through AX, Initially we need to configure the e-mail parameters in the administration module. 2. If you want to configure an email template. That can also be done from the basic module. LanguageId LanguageId; FilePath FilePath; SysMailer mailer; SysEmailAddress ToAddress; SysEmailId EmailId; new InteropPermission(InteropKind::ComInterop).assert(); FilePath = @’//10.0.23.25/AOSPrintShare/TestSalesOrder.pdf; mailer = New…

|

How to use COM Wrapper dll in AX

Here, I am telling you about how to register a COM wrapper dll and then extract & use it in AX. (i) Install the COM Wrapper DLL Files, into the bin directory of the AOS. (ii) Register it with the following Command,%WINDIR%Microsoft.NETFrameworkv2.0.50727regasm.exe Test.Wrapper.DLL /tlb:Test.Wrapper.tlb (iii) Now, After Successful Registration, Follow the below path and click…