Skip to main content

Posts

Showing posts with the label AX 2012

AX 2012: File existance check

Multiple ways to check file existance in AX 2012; Client side check, does not work with batch job WinAPI::fileExists(_fileName); Server side check which works for run base batch too public boolean getFileExists(filepath _fileName) {    System.IO.FileInfo   fileInfo;     new InteropPermission(InteropKind::ClrInterop).assert();    fileInfo = new System.IO.FileInfo(_fileName);     return fileInfo.get_Exists(); }

AX 2012 - How to retrieve meeting (appointment) status from Outlook

Mi crosoft Dynamics AX 2012 provides a very convenient way to synchronize outlook tasks, contacts and appointments back into AX.  MSDN topics describe the integration in details. https://technet.microsoft.com/en-us/library/aa498242.aspx https://technet.microsoft.com/en-us/library/gg230659.aspx Let's discuss the main motive of this post; How can you retrieve the meeting (appointment)  status  from outlook back to AX 2012. Before I show you where and what code need to add or change, I will show the existing functionality how it works. Go to Home > Periodic > Microsoft outlook synchronization > Synchronize Here you can see, be default it tries to sync Contacts, Tasks and Appointments within provided date range. I will focus on Appointments for this post and sync Appointments only, Let's assume I have following meeting (appointment) response in my outlook, remember it was a meeting invitation which I sent from AX and now I have their responses back ...

How to implement Runbase form in AX

Today I had a requirement that allow users to run Outlook synchronization process in batch rather sync it manually using out of the box functionality. Let's have a look on existing functionality and then extend it to achieve the requirement of running it in batch. Existing functionality in AX Home> Periodic > Synchronize [AOT form name is smmOutlookSyncrhonization ] As you can see someone has to manually sync outlook emails to AX acvitities or viceversa. Extended functionality in AX Let's implement this functionality in batch so users can set recurrence the Sync. Create a new class; class SyncOutLookEmails_RunbaseForm extends RunBaseBatch {     // Packed     TransDate            testDate; // I am using this variable for own testing purpose     #define.CurrentVersion( 2 )     #define.Version1( 2 )     #lo...

PostLoad() method in AX tables

Today I found an interesting thing with regards to AX tables and this post is all about this new experience which is the PostLoad() method in AX tables. When we create a new table in AOT, Morphx automatically creates a series of methods for it. We cannot see those methods but those can be overriden on each table as per requirements. PostLoad() is one of these system methods. List of all system methods can be seen from here  https://msdn.microsoft.com/en-us/library/aa625830.aspx Lets create a new table, I named it PostLoadTable with two fields Name and Value. I added 5 records in the table manually (open table and added). Tables in Microsoft Dynamics AX have a number of system-defined methods, such as insert, validateField,validateWrite. For a list of these methods, see the xRecord system class. The xRecord class can be seen as the base class for the Common table. The Common table can be seen as the base t...

How to check table size from SQL server

We often require to check size of the table to moniter database performance, specially working with files and storing it in database. AX does store files in database which can be setup under Document types in Document Management module. We can use following sql command to get table size; sp_spaceused docuValue

Retrieve worker email address through X++

Below code snipet is one of the way to retrieve employee/worker's primary email address. private LogisticsElectronicAddressLocator getInstructorEmail(HcmWorkerRecId  _workerRecId) {     LogisticsElectronicAddress  logisticsElectronicAddress;     HcmWorker                   hcmWorker;     DirPerson                   dirPerson;     DirPartyTable               dirPartyTable;     select hcmWorker         where hcmWorker.RecId == _workerRecId     join dirPerson         where dirPerson.RecId == hcmWorker.Person     join dirPartyTable         where dirPartyTable.RecId == dirPerson.RecId     join logisticsElectronicAddress         where dirPartyTable.PrimaryContactEmail == logisticsElectr...

Show methods in AX lookups

This sample code is used to show Customer Name in lookup, In AX 2009 we had name field in CustTable but now its moved to DirPartyTable. We still have name() in CustTable which we can use to display name in lookups. AX 2009 client static void lookupInterCompanyItemId(FormStringControl   lookupCtrl, DataAreaId _dataAreaId = "") {     SysTableLookup          sysTableLookup = SysTableLookup::newParameters(tablenum(InventTable), lookupCtrl);     Query                   query = new Query();     QueryBuildDataSource    qbds = query.addDataSource(tablenum(InventTable));     ;     sysTableLookup.addLookupfield(fieldnum(InventTable, ItemId));     sysTableLookup.addLookupfield(fieldnum(InventTable, ItemName));   ...

InventTrans table data model changes in AX 2012 vs AX 2009

The purpose of this post is to give an overview about the changes been made in the Dynamics AX 2012 data model related to inventory transactions. For more details; how to implement code changes for inventTrans table the best resource is this white paper  Implementing InventTrans refactoring for Microsoft Dynamics AX Applications AX2012 Before AX2012, the only table used for recording all the inventory transactions was  InventTrans .  In AX2009, a lot of data in InventTrans is either redundant or fields are used to represent a specific type of transaction like sales, purchase, transfer etc. In AX2012, the base is still the same i.e. every inventory still gets recorded in the  InventTrans  but the only difference is that the table has been more normalized now. A new table has been added called  InventTransOrigin  which is actually now holding the relationship between the originating tables (transaction tables) and InventTrans . The InventT...

AX to SQL data dictionary synchronization issues

One of my clients restored their AX database from PROD to DEV environment for AX 2009 and on database sync following error message was thrown Cannot execute a data definition language command on (). The SQL database has issued an error. Problems during SQL data dictionary synchronization. The operation failed. Synchronize failed on 1 table(s) This error message does not tell you which table is failing during sync, when I checked from event log I found following error logs which tells you table name but error message was totally misleading. “Object Server 01: The database reported (session 5 (#####)): [Microsoft][SQL Native Client][SQL Server]There is already an object named '<TABLENAME>' in the database”   "Object Server 01:  The database reported (session 23 (#####)): [Microsoft][SQL Server Native Client 10.0][SQL Server]Cannot drop the table  '<TABLENAME>', because it does not exist or you do not have permission.. The S...

Error when validate settings in Report servers by any admin account which is not account used to install the AX reporting services extensions.

First thing you need to verify the Service account and Execution Account are properly configured under Reporting Services Configuration Manager. After some troubleshooting, I found UAC was not turned off. I was running on MS Windows Server 2012. UAC has to be turned off via registry by changing the DWORD "EnableLUA" from 1 to 0 in "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system". You will get a notification that a reboot is required. After the reboot, UAC is disabled. After UAC is disabled, the issue is resolved. social.technet.microsoft.com/.../13953.windows-server-2012-deactivating-uac.aspx

How to create Info part and use it on List page

This post is about how to create info Part in AX and use it on list page. For this example; I am using Projects List page and will add Revenue Info Part on it. Right click on AOT\Parts\Info Parts and create New Info Part Assign Query to this info part I have assigned ProjTable_NoFilter query Add New Group under Layout Name it ProjectRevenue and set few properties as shown Note I haven't assigned DataSource to this group, I will be using data methods to get data here. Add new fields under ProjectRevenue group and name it RevenueAtSales and RevenueAtOrders   I assigned ForecastRevenueAtSalesSw data method to field RevenueAtSales, this data method is written on at \Data Dictionary\Tables\ProjTable\Methods\forecastRevenueAtSalesSw display AmountCur forecastRevenueSw() {     ProjForecastOnAcc projForecastOnAcc;     real total...