AX 2012: crossCompany delete_from

Although we cannot use crossCompany keyword with delete_from command, we can still achieve the same functionality with some performance overhead as follows: static void JobCCDel( Args _args ) { Table21 tab21a, tab21b; ttsBegin; while select crossCompany minof(ratingNum), dataAreaId from tab21a group by dataAreaId { changeCompany(tab21a.dataAreaId) { tab21b = null; delete_from tab21b where tab21b.ratingNum == tab21a.ratingNum; … Continue reading AX 2012: crossCompany delete_from

AX 2012: crossCompany update_recordset

Although we cannot use crossCompany keyword with update_recordset command, we can still acheive the same functionality with some performance overhead as follows: static void JobCCForUpdMethod(Args _args) { Table21 tab21; ttsBegin; while select forUpdate crossCompany countOfReviews from tab21 { changeCompany(tab21.dataAreaId) { tab21.countOfReviews = tab21.countOfReviews + 2; tab21.update(); } } ttsCommit; }

AX 2012: crossCompany insert_recordset

Although we cannot use crossCompany keyword with insert_recordset command, we can still achieve the same functionality with some performance overhead as follows: static void JobCCIns(Args _args) { Table21 tab21; Table22 tab22; ttsBegin; while select crossCompany actionDate, name, dataAreaId from tab21 where tab21.actionDate > str2Date('1998-01-22', 321) { changeCompany(tab21.dataAreaId) { tab22 = null; tab22.actionDate = tab21.actionDate; tab22.name … Continue reading AX 2012: crossCompany insert_recordset

AX 2012: Display methods – Different datasources – Same control

AX developers always come across a requirement of showing data from different datasources on the same control though these datasources should be related to each other. The solution to this requirement is to define display methods on the table which you choose to be the control datasource. Display methods are very handy for showing data … Continue reading AX 2012: Display methods – Different datasources – Same control

AX 2012: Generate next number sequence in X++

Often we do not need to generate the next number sequence manually in X++ since creating records by using forms the system automatically handles number sequence generation by invoking Number Sequence Framework. However, sometimes we need to generate number sequences manually in X++. The following code helps you to do that: static void numberSequence(Args _args) … Continue reading AX 2012: Generate next number sequence in X++

AX 2012: Change Application Object Layer

Developers often need to change the current application object layer. For example, customizations in AX 2012 always take place in the USR layer. To change it:1. Go to Microsoft Dynamics AX 2012 ConfigurationĀ 2. Click Manage then click Create configurationĀ 3. Give it a suitable name and then click OK4. Switch to Developer tab and choose your … Continue reading AX 2012: Change Application Object Layer