Posts

Showing posts from 2010

How InventDimSetup dimensions are connected with the dimensions

static void Job6(Args _args) { InventTable inventtable; InventDimSetup setup; InventDimGroup inventGroup; ; inventtable = InventTable::find('1500M'); inventGroup = InventDimGroup::find(inventtable.DimGroupId); select firstonly setup where setup.Active == NoYes::Yes && setup.dimGroupId == inventGroup.dimGroupId && setup.dimFieldId == fieldnum(inventdim,configid); }

AOS name in statusbar

There is an option on the ‘status bar’ tab of the options screen (AX button – Extra – Options), that in somecases does not display the AOS name. If the option doesn’t work for you, it is because you did not specify the Instance Name in your client configuration. You’ll have to restart AX for this to be visible in the status bar. Also note that this doesn’t really show the AOS you are connected to, it merely shows the value you specified in the instance name field in your configuration. If you have specified the correct port, you can write anything in this field.

Avoid old setting problems with ax after upgrade

This job clears last selected values in forms etc... static void UpgradeClearLastValue(Args _args) { SysLastValue _sysLastValue; ; ttsbegin; delete_from _sysLastValue where _sysLastValue.userId != ""; ttscommit; }

Overview of Dynamics AX build numbers

http://blogs.msdn.com/b/emeadaxsupport/archive/2009/07/01/overview-ax-kernel-build-numbers.aspx

Iterate over multiselected posts

Usefull code that gets the selected posts. void iterateSelectedRecords() { CustTable custLocal; ; //getFirst method gets all the selected records in the grid custLocal = CustTable_ds.getFirst(true); while (custLocal) { // Do something with the posts // get the next selected record custLocal = CustTable_ds.getNext(); } } Another usefull function is *****_ds.mark(), which returns the number of selected posts.

Missing CustCollectionLetterNote transactions after upgrade AX 3 to AX 2009

The table CustCollectionLetterTrans in Axapta 3 was extended with a field called AccountNum in Dynamics AX 4.0. This new field is used as a relation between CustCollectionLetterJour and CustCollectionLetterTrans. If you upgrade from AX3 to Dynamics AX 2009 the upgrade scripts will not update the transactionsrows which will result in all collection letters missing their transactions. To fix the problem loop over the CustCollectionLetterJour posts and update their corresponding transactions. update trans set trans.AccountNum = jour.AccountNum from CustCollectionLetterTrans trans join CustCollectionLetterJour jour on trans.collectionletternum = jour.collectionletternum and trans.dataareaid = jour.dataareaid

Bug in the Dynamics AX 2009 installation on Windows Server 2008

During the installation of Dynamics AX 2009 server on a Windows server 2008 the installtion creates a inbound rule in the windows firewall. The bug will create a none valid path to the server binary. This will make the AOS service unavalible when trying to access from an other computer with a axc file. To fix the problem find the Dynamics Server in the inbound firewall rules, open the properties, select the "Programs and Services" tab and take a look at the path to "This program". The path will be missing the ".exe" in the end. Either use the browser to locate the server binary again or add ".exe" in the end of the path.

Post and Pre sync, missing number sequence

Before starting the upgrading process make sure that used number sequences are correct setup in the ax3 environment, otherwise you can get errors during the database post/pre sync. if you forget doing this you will need to comment the code that uses the none setup number sequence and run the upgrade script once the whole setup is complete.

Updating datasource in a form

A good rule is to use either formDataSource_ds.research() formDataSource_ds.refresh() or formDataSource_ds.reread() formDataSource_ds.refresh() Follow link for better information. Here is a good document that describes how to update datasources in forms .

Upgrade notes affecting specific modules

Asset depreciation schedules (ITA) Issue: Field mapping issue may cause inaccurate depreciation schedules Modules affected GDL, General ledger, Fixed assets Versions affected Microsoft Dynamics AX 3.0 and 4.0 Upgrade note A field-mapping issue has been identified that could cause a company to lose data in the AssetDepreciationProfile table during the upgrade to Microsoft Dynamics AX 2009, leading in some cases to invalid proposed depreciation schedules. This risk of data loss is possible only when the following conditions are met: The Italian configuration key is enabled for a company Depreciation profile records have been created for that company with these settings: The method is set to Manual The interval is set to Yearly The calculation base is set to Months Because of this field-mapping issue, the CalculationBase field in the AssetDepreciationProfile table will be dropped when the upgrade to Microsoft Dynamics AX 2009 is performed. (In a depreciation profile, the value of base enu

Removing enum value from a form combobox

This is an example of how to remove a enum value at runtime from a combobox in a form. The enum have 2 values Enum::value1 Enum::value2 Overwrite the "enter" method on the combobox and write the following. combobox:enter() { super(); this.delete(enum2str(Enum::value2)); } Now only option 1 will be displayed.

Edit the result of a lookup method

Good guide that describes how to edit the lookup method. http://www.axaptapedia.com/SysTableLookup_class Good guide that describes how to create a lookup form. http://www.axaptapedia.com/Lookup_Form

Extracting label in x++ code

To do this use the labelId2String method of the SysLabel class. Example: SysLabel::labelId2String2(literalstr('@SYS1'), 'en-us'); Gives: Time transactions

xPropertySetData::unpack : Property not found : 1024/2056

xPropertySetData::unpack : Property not found : 1024/2056 This happened after an upgrade process. When a user started a specific report and wanted to set a query, the client crashed (Ax32.exe - Fatal Application Exit). This was only happening to specific users, and with the queries of specific reports. The report itself could be run by the user, as long as the user didn't try to modify the query. I began to investigate the problem and found this solution in a post I tryed stop/start AOS, recompiling and synchronizing. I read the posted and did som investigation myself and concluded the same as in the post that that the client crashed when executing code in class SysQueryForm, method QueryUnpack. When trying to create a new query object with old saved data, the client crashed. SOLUTION: First try to clear user data that can be reset in Dyn AX. Administration\User\Userdata. Second try not to use those old saved queries, just use those of the current version. (replace if (queryPack

How to get the current active company in AX

By running the curExt() function the current active company is returned. static void curExtExample(Args _arg) { str s; ; // Sets s to the extension of the current company. s = curExt(); print "Current extension is " + s; pause; }

Removing duplicate records

When you make a change in the layers of AX you will be faced with the installtion checklist. I some cases a removal of a layer might cause duplicates of records that can cause error when trying to synchronize the tables. To solve this problem a removal of the duplicate records is necessary. This can be done with the sql query below: delete from LedgerBalancesDimTrans where exists( select * from LedgerBalancesDimTrans as test_inner where test_inner.dataareaid = LedgerBalancesDimTrans.dataareaid and test_inner.accountnum = LedgerBalancesDimTrans.accountnum and test_inner.transdate =LedgerBalancesDimTrans.transdate and test_inner.periodcode = LedgerBalancesDimTrans.periodcode and test_inner.dimension = LedgerBalancesDimTrans.dimension and test_inner.dimension2_ = LedgerBalancesDimTrans.dimension2_ and test_inner.dimension3_ = LedgerBalancesDimTrans.dimension3_ and test_inner.ledgerbalancesvariant = LedgerBalancesDimTrans.ledgerbalancesvar

Execution order of classes in journal

Here is something good to know about the executionorder or batchclasses in a journal for Dynamics AX 4.0. The classes that are included in a journal are executed sequentially. But this is not done by the order decided with the Up/down buttons. That which decides the execution order of the classes is the order that the classes are added, hence the RecId order.

Dynamics AX 2009 AOS do not start, eventid 110

I have found a solution for this issue. To solve that, I have just delete CREATESERVERSESSIONS and CREATEUSERSESSIONS stored procedures, and run follow scripts: Then make sure that the user that is running the aos service has the rights to execute the procedures. --------------------------------------------------------------------------------------------------------------------------------------------- USE [DB NAME] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE procedure [dbo].[CREATESERVERSESSIONS] @aosId varchar(50), @version int, @instanceName nvarchar(50), @recid bigint, @maxservers int, @status int, @loadbalance int, @workload int, @serverid int OUTPUT as declare @first as varchar(50) declare @max_val as int begin select top 1 @first = SERVERID from SYSSERVERSESSIONS WITH (UPDLOCK, READPAST) where STATUS = 0 and AOSID = @aosId and INSTANCE_NAME = @instanceName if (select count(SERVERID) from SYSSERVERSESSIONS where SERVERID IN (@first)) > 0 begin update SYSSERVER

Restore SQL DB from a network location

This can me done over the network. Just make sure that the account that runs the sql server can access the folder containing the .bak file. List the files in your database backup using: RESTORE FILELISTONLY FROM DISK = 'C:\Projects\Data\Northwind.bak' Execute the backup using: RESTORE DATABASE Northwind FROM DISK = 'C:\Projects\Data\Northwind.bak' MOVE 'Northwind_Data' TO 'C:\Projects\Web\Data\Northwind.mdf', MOVE 'Northwind_Data2' TO 'C:\Projects\Web\Data\Northwind.ndf', MOVE 'Northwind_Log' TO 'C:\Projects\Web\Data\Northwind.LDF' The replace command will create it from scratch.

Upgrading AX 3.0 to 2009

Before doing the upgrade read my other posts on upgrading. I also recommend reading Microsofts white paper called "AXUpgradeGuide". For the upgrade i recommend using this two part guide that can be found here and here . Clarifications: PART 1 (Code Upgrade) When doing this I recommend by starting with the tables, use compare and check all tables. MS have added new deleteactions that will be shadowed by the std deleteactions, these need to be added manually. The same thing goes for base enums. Use the compare tool in AX 3 to identify the new baseenum elements, delete the modded enum in ax 2009 and add the new elements that you identified in AX 3. All the menues need to be recreated to get the new AX 2009 icons, used the same method here as for base enums. Forms are also added as whole objects i recommend deleting them in AX 2009 and looking the AX 3 what modifications have been done here. PART 2 (Data upgrade), STEP 2 Importing and running of these two project are done in th

Code and technical differences between AX 3.0 and 2009

During a upgrade from AX 3.0 and 2009 i discovered that many of the classes no longer exists in AX 2009 or have been divided into several subclasses. Here are some things that are good to know. - The Forms are considerd as a whole object by ax which replaces all functionallity in 2009 by 3.0 functions and looks if you dont implement the changes manually. - The new method in AX 3.0 have been replaced with static functions that are called "construct" in 2009. - (3.0 Class)Specification is replaced by (2009 Class)SpecTransManager - LedgerJournal.newJournalNum(true); is done with a call to the static function NumberSeq::newGetNum(LedgerParameters::numRefJournalNum(), true).num(); - NumberSeq::newGetVoucherFromCode(voucherSequence) is a new way of getting the voucher instead of using LedjerJournal. NumberSeq also contains other static functions for this with different paramters. - LedgerJournal.usedVoucher(); is done with a call to NumberSeq::newGetVoucherFromCode(voucherSeque

AOS does not start after upgrade to AX 2009

After doing a code upgrade and trying to make a dataupgrade this error might occure when starting the AOS. Problem: Object Server 05: The database reported (session 1 (-AOS-)): [Microsoft][SQL Native Client][SQL Server]Invalid object name ‘SYSSERVERSESSIONS’.. The SQL statement was: “SELECT A.SERVERID,A.AOSID,A.INSTANCE_NAME,A.VERSION,A.LOGINDATETIME,A.LOGINDATETIMETZID,A.STATUS,A.LOADBALANCE,A.WORKLOAD,A.LASTUPDATEDATETIME,A.LASTUPDATEDATETIMETZID,A.RECVERSION,A.RECID FROM SYSSERVERSESSIONS A WHERE (STATUS=?)” Object Server 05: SQL diagnostics: [Main Microsoft Dynamics Application Object Server Session]Unable to report problem. Attempted to open message 310. Object Server 05: Dialog issued for client-less session 1: Cannot select a record in Current AOS instances (SysServerSessions). ServerId: 0, . The SQL database has issued an error. Object Server 05: The database reported (session 1 (-AOS-)): [Microsoft][SQL Native Client][SQL Server]Invalid object name ‘SYSCLIENTSESSIONS’.. TheSQ

SHRINKER.ERR

Problem: When installing a fresh copy of Dynamics AX 3.0 SP5 and compiling the installation for the first time i got a "SHRINKER.ERR" error. Solution: Download the latest version of GridEX20.ocx from here and replace the current in "Client/Bin" folder. This will make the error go away.

Good to know about AxDBUpgrade.exe

IMPORTANT! AxDBUpgrade.exe MUST BE RUNED! on the computer that hosts the AX 3.0 and AX 2009 database. The reason is that the program retrives information from the AX 3.0 database, stores it in the temp folder and does a bulk insert into the AX 2009 database. This also means that the user running the application will require permissions on the sql server to do bulk insertion. Problem: When trying run the AxDBUpgrade the following error can occure, "Cannot read the list of columns to be upgraded" Solution: You have to start the AX 3.0 environment, import the PrivateProject_UpgradeColumnList.xpo from the Dynamics AX 2009 dvd. When the form is imported, run it and press the generate button. This will fill the table UpgradeColumns with information about which fields that should be upgraded to 64-bit by the AxDBUpgrade tool. Problem: When trying to start AxDBUpgrade.exe on a operating system with 64-bit architecture you might encounter the following error "The application fail

The Dynamics AX Object Server 5.0 service terminated with service-specific error 80 (0x50)

When attempting to start the AOS Service after changing the Log on, the following error appeared: Windows could not start the Dynamics AX Object Server 5.0$01-[Application] on [Server]. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 80. System Event Log: The Dynamics AX Object Server 5.0$01-[Application] service terminated with service-specific error 80 (0x50). This occurred regardless of any database permissions. The workaround was to apply the following permissions to the following folders: * %ProgramFiles%\Microsoft Dynamics AX\50\Application\Appl\[Application] o Modify, Read & execute o List folder contents o Read o Write * %ProgramFiles%\Microsoft Dynamics AX\50\Server\[Application]\Log o Read o Write If you still receive login error (code 100) after applying this fix, make sure you have created login

User login problem after restoring DB in MSSQL 2005

After doing a restore of a DB from file it can happened that the database users are no longer linked with the servers login users. This problem will result in a db user being able to log in but not to access the databases. To check for problem use the following code, change TargetDB to the target database and username with the user. use master go select name as sqllogin,sid as serversid from sys.syslogins where [name] = ' username ' use TargetDB go select name as databaseid, sid as databasesid from sysusers where [name] = ' username ' go use TargetDB go sp_change_users_login @Action='Report' go Compare serversid and databaseid, if not equal then run use TargetDB go sp_change_users_login @Action='update_one', @UserNamePattern=' username ', @LoginName=' username ' go Read more here