RSS

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++

 

Tags:

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 ==
LogisticsPostalAddress::findRecId(purchTable.DeliveryPostalAddress).Location;
info(LogisticsElectronicAddress::findByLocation(logisticslocation.RecId).Description);
info(LogisticsElectronicAddress::findByLocation(logisticslocation.RecId).Locator);
}
 
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
stringVar2=strRem(strAlpha(stringVar1),”1234567890″);

if(stringVar2!=stringVar1 )
{          throw error(“Enter Valid data”);
}else
{            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;

dirParty.createOrUpdateContactInfo(dirPartyContactInfoView);

}

 
Leave a comment

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

 

Tags: ,

 
All About Dynamics 365

Dynamics 365, D365, Implementor

syedrafayali

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

Philippsen's Blog

Everyday findings in my world of .net and related stuff

Microsoft Dynamics AX

A great WordPress.com site

Finite Minds

Adventures in IoT

Dynamics Ax

Technical Knowledge

timsaxblog

A blog about implementing Microsoft Dynamics AX and Dynamics 365 for Operations

Microsoft Dynamics 365 Blog

All Things Dynamics 365, A Blog by sandeep chaudhury

DEVSerra - Dynamics AX development blog

Your official Microsoft Dynamics AX blog.

OrganicAX

Discovering Dynamics

AX

A blog by Hai Nguyen

Learn Dynamics Ax with Johnkrish

Live as if you were to die tomorrow. Learn as if you were to live forever - Mahatma Gandhi ****** The more I learn, the less I know - Albert Einstein

Twisted Untwirled

Just another WordPress.com site

ramdynamicsax

Just another WordPress.com site

guyterry's Dynamics AX blog

Just another Dynamics AX blog

Chaitanya kumar

Happy DAXing...!!! :)