Showing posts from June, 2013

Getting number of rows loaded

Getting number of rows loadedTo get the number of rows loaded to the Dynamics AX datasource query, you can use the following code which is default function of the datasource.

For example:


Application Integration Framework Overview

Application Integration Framework Overview Application Integration Framework (AIF) is the infrastructure within Microsoft Dynamics AX with which you can expose business logic or exchange data with other systems. AIF is comprised of three primary components: Services - Enable you to expose business logic written in X++ as a service to be consumed by other applications. Within Microsoft Dynamics AX, you can create, customize, and publish services. Document services - A specific implementation of services in which the Microsoft Dynamics AX business logic is exposed through document services. Consume Web services - In Microsoft Dynamics AX, you can consume external Web services from your X++ code.
For origional post follow below link Application Integration Framework Overview -Harry

Creating Vendors through X++ in AX 2012- PART V

Creating Vendors through X++ in AX 2012- PART V--Create bank details for the vendor--

privatevoid createBankDetails(WI_VendorRequestCreate          _vendorRequestCreate,
                               VendAccount                     _vendAcc)
    VendBankAccount         vendBankAccount;
    LogisticsLocation       lLogisticsLocation;
    LogisticsPostalAddress  logisticsPostalAddress;
    lLogisticsLocation.Description      = _vendorRequestCreate.FirstName;
    logisticsPostalAddress.Street       = _vendorRequestCreate.VendBankAddress;
    logisticsPostalAddress.Address      = _vendorRequestCreate.VendBankAddress;
    logisticsPostalAddress.Location     = lLogisticsLocation.RecId;
    vendBankAccount.AccountID           = subStr(_vendorRequestCreate.BankAccount,1,10);
    vendBankAccount.Name                = _vendorRequestCreate.BankAccount;
    vendBankAccount.AccountNum          = _vendorRequestCreate.BankAccoun…

Use resource files in Axapta

Use resource files in AxaptaIn Application Object Tree, you can find resources node.
Select resources node and right click; select Create from File, specify the file location for the new resource file. After that you can use this resource file in Axapta without specifying an absolute file path in your local/server system.

First, pick up the resource node from AOT;


Then generate a temporary file for this resource file;


Finally specify the temporary file path for controls.
Here comes an example to show how to use a resource file as a background image of  a given form.

ResourceNode            resourceNode;
FilePath  imagename;
resourceNode = SysResource::getResourceNode(resourcestr(ResourceName));
if (resourceNode)
resourceNode. AOTload();
imagename =  SysResource::saveToTempFile(resourceNode);
throw Error(“No file exists.”)

You can try This also
Add a resource file in Resource node unde…

Conditional Joins in x++

Conditional Joins in x++ Here is the code to apply joins conditionally in Microsoft Dynamics AX.
query = new Query();
dsInventTable = query.addDataSource(tableNum(InventTable), "InventTable");
dsInventItemBarCode = dsInventTable.addDataSource(tableNum(InventItemBarCode), "InventItemBarCode");
// Add any two ranges
queryBuildRange1 = dsInventTable.addRange(fieldNum(InventTable, DataAreaId));
queryBuildRange2 = dsInventItemBarCode.addRange(fieldNum(InventItemBarCode, DataAreaId));
Find all records where either the ItemType is Service, or the ItemType is Item and a barcode exists. The join criteria is only applied in the second half of the expression, so all Service items will appear irrespective of whether they have a bar code. Again, this is not possible to achieve using the standard query ranges.
queryBuildRange2.value(strFmt('((%1.%2 == %3) || ((%1.%2 == %4) && (%1.%5 == %6)))',

Generate Next Number Sequence by x++ code

Generate Next Number Sequence by x++ codeWhen we create a new record from user interface(by using Forms) number sequence handles automatically by system. But Some time we need to assign a number sequence by code, like we create numbers of records by code and in this case we have to take care of number sequence. 
Here a job to create next number from a number sequence by x++ code.

static void theaxapta_Nextnumseq(Args _args)
         NumberSeq num;
DiscountTable  _DiscountTable; //Table Buffer
           num = NumberSeq::newGetNum(HrmParameters::numRefJournalNum()); // Parameters Table
_DiscountTable.NextNumseq = num.num(); // Next NumberSeq generated
          num.used(); // Mark the Number as Used

//The other Way is by using EDT

static void testnumseq(Args _args)
     theaxaptaEDT   _theaxaptaEDT   ;
     ExtendedTypeId id = TypeID2ExtendedTypeId(TypeId(theaxaptaEDT));//EDT NAME
     NumberSeq num = NumberSeq::newGetNum(NumberS…

Changed, and Deprecated Features for Microsoft Dynamics AX 2012

Hi Folk,

As we all know, there are many new changes came in AX2012 and many few are depreciated from earlier version. Recently while searching over internet i come across one book that will provide all such information. Below is the link to download this book.

New, Changed, and Deprecated Features for Microsoft Dynamics AX 2012, available for download here.


Finding AOT object by its propery

Finding AOT object by its properyIn Dynamics AX we can find all the AOT objects by specifying some property. Lets say we want to find all the tables in AOT having "SaveDataPerCompany" property set to No.
We can use the following x++ job
The X++ job below shows how to find all tables in the AOT where the SaveDataPerCompany property is set to No.

static void findAOTObjectByProperty(Args _args)
TreeNode treeNodeTables = TreeNode::findNode(#TablesPath);
TreeNode treeNode;
str strPropertyName = 'SaveDataPerCompany';
str strPropertyValue = 'No';
// first table
treeNode = treeNodeTables.AOTfirstChild();
while (treeNode != null)
if (treeNode.AOTgetProperty(strPropertyName)== strPropertyValue)
// next table
treeNode = treeNode.AOTnextSibling();

You can search other property by modify below line of code
 "treeNode.AOTgetProperty(strPropertyName)== strPropertyValue"


Windows 8.1 release date, price and features

Here a good post on Windows 8.1, just check it out guys….