Category Archives: X++

Loop through Grid Selected records :AX2012 : X++ code to access marked records on a form

This code is for select multi record and click on button then that records fields update in to child and parent table

1. Add a new button on the form.
2. Set property “MultiSelect” to Yes.
3. Override the clicked method of the button and code as shown below :

Inside the for loop you can write the logic which you want to process.

Leave a comment

Posted by on June 2, 2016 in AX 2012, X++


What are the differences between addOrderByField and addSortField

With addSortField you can set “only” the records order.

With AddOrderByField you can build some logic because is used the kernel class QueryOrderByField.

So, you can use the follow methods :
– direction
– autoHeader
– autoHeaderDetailLevel
– autoSum
– autoSumDetailLevel
– datasource
– fieldId

You can find some examples on the standard class :

– DimensionProvider Class, getDimensionOrderBysFromQuery method
– InventDimCtrl_Frm_OnHand class, modifyQuery method

Leave a comment

Posted by on June 12, 2015 in AX 2012, X++


Tags: ,

How to get Label Id from a text

If you want retrieve the Label ID from a specific text description, here the code.
If are present more Label ID for a specific text, you will have the first.

sysLabelEdit     sysLabelEdit = New sysLabelEdit();
labelid          labelid;
str              text = “Customer account”;
str              specialCharsText;

specialCharsText = SysLabel::searchStringBuildSpecialCharString(text);
specialCharsText = SysLabel::seachStringBuildExactStr(specialCharsText);

labelid = sysLabelEdit.findLabel(“en-us”, specialCharsText);

info ( labelid );

Leave a comment

Posted by on June 12, 2015 in X++



Cascade+Restricted Concept in Ax 2012Ax

Step 1:
Create 3 tables for an example :

Table 1- SheetTable, with Two fields Sheetid and sheetname
Table 2-PartitionTable with three fields sheetid , partitionid and sheetsize
Table 3-SheetPartitionTable with two fields partitionid and Shape 

Step 2:

1) Create a relationship between SheetTable and PartitionTable (Ex:PartitionTable.SheetID==SheetTable.SheetId) 

2) Create a relationship between PartitionTable and SheetPartitionTable(EX:SheetPartitionTable.PartitionID==PartitionTable.PartitionID)

Step 3:

1) Create Cascade DeleteAction between SheetTable and PartitionTable

2) Create Cascade+Restricted DeleteAction between PartitionTable and SheetPartitionTable

Step 4:
Open SheetTable and delete the matched record with PartitionTable.

Automatically the matched record from SheetTable , PartititonTable and SheetPartitionTable will be deleted .

Leave a comment

Posted by on June 10, 2015 in AX 2012, X++


Tags: ,

Get the phone number of the Delivery Address in the Purchase Order

static void getphoneNumber(Args _args)
PurchTable purchTable;
LogisticsLocation logisticslocation;
LogisticsPostalAddress logisticsPostalAddress;
select purchTable where purchTable.PurchId==”P000059″;
select logisticslocation where logisticslocation.ParentLocation ==
Leave a comment

Posted by on June 10, 2015 in AX 2012, X++


Tags: ,

Validate the Special Characters from the given String in Ax 2012

X++ code to validate the special characters from the given string

static void RemoveSpecialCharacters(Args _args)
{str stringVar1,stringVar2;

//String with special characters and numbers
stringVar1= test!@#$%^&*(){}[]|\+-;,.?/~`12344;

//String without Special characters and  numbers

if(stringVar2!=stringVar1 )
{          throw error(“Enter Valid data”);
{            info(“ok”);

Leave a comment

Posted by on June 10, 2015 in AX 2012, X++


Tags: ,

Add contact information for entity

How you can add contact information data to an existing entry in the global address book.

static void createPartyContactInfo(Args _args)
DirPartyTable dirPartyTable = DirPartyTable::findByNum(‪‪”100000″);
DirParty dirParty;
DirPartyContactInfoView dirPartyContactInfoView;

// Edit Global address book
dirParty = DirParty::constructFromCommon(dirPartyTable, DirUtility::getCurrentDateTime(), DirPartyType::Organization);

// Create contact info
dirPartyContactInfoView.LocationName =’Office’;
dirPartyContactInfoView.Locator =’+43 1 4654646′;
dirPartyContactInfoView.Type = LogisticsElectronicAddressMethodType::Phone;
dirPartyContactInfoView.IsPrimary = NoYes::Yes;



Leave a comment

Posted by on May 26, 2015 in AX 2012, X++


Tags: ,

Nishant Rana's Weblog

Everything related to Microsoft .NET Technology


A practitioner's views on Dynamics 365 for Operations and Finance

Supreme X++

A blog about good and bad development in Microsoft Dynamics AX

Microsoft Dynamics 365

Pavan Kumar Garlapati

Microsoft Dynamics AX/365 Finance and Operations Development Blog

Technical blog about Dynamics AX 2012 and Dynamics 365 for finance and operations


Dynamics 365 Blog

vmoskalenko blog

SQL, AX, Windows, Azure

Syed Rafay Ali

This blog contains information about Functional techniques and guidelines in Microsoft Dynamics AX, including tips, tricks, tutorials, tools and upcoming news enhancement in Microsoft Dynamics Ax

All About Microsoft Dynamics

Microsoft Dynamics AX, Microsoft Dynamics 365 for Finance and Operations, D365, Retail, SQL

Anitha Eswaran - Dynamics Ax

Microsoft Dynamics Ax blog


AxaptaHut ax = new AxaptaHut();

All About Dynamics 365

Dynamics 365, D365, Implementor

Philippsen's Blog

Everyday findings in my world of .net and related stuff

Microsoft Dynamics AX

A great site


All things Blockchain, AI and IoT

Dynamics Ax

Technical Knowledge