How to clear inactive sessions from Dynamics Ax 2012

by alirazazaidi on August 19, 2014

If you check the online user in Administrator Module, You may be found some session with inactive and block status. These inactive and block session are due to crashing of AX clients. These sessions are not create any problem, but possible issues with limited number of active users under Dynamics Ax license. Best approach to clear these inactive and block session form Dynamics Ax to avoid any future conflict with Licensing. All these session information is stored in “SysClientSessions.” Table.

Second Problem we usually face that when we start AOS service, it take too much time change status from Starting to started. One of many reason for this phenomena that AX try to query and located any Active session in SysClientSessions.  To reduce the time is to remove all session inactive from SysClientSessions table or possible remove the inactive and block session form Database. In “SysClientSessions” Status with status 0 (Inactive), Status 2 (Ending Waiting for AOS), 3 (Ending –Block).

 

Perform following steps.

  1. Stop AOS service.
  2. Open SQL Server Management Studio
  3. Open any new query on Dynamics Ax Database.
  4. Run the following Query where sessions with status 0 (Inactive), Status 2 (Ending Waiting for AOS), 3 (Ending –Block).

delete from SysClientSessions where status in(0,2,3)

  1. Restart AOS.

Hopes this will works to start AOS service faster than previously.

{ 0 comments }

Dynamics Ax 2012 R3 System Requirements

by alirazazaidi on August 15, 2014

System Requirements for Microsoft Dynamics Ax 2012 R3 Updated by Microsoft. For this purpose Microsoft uploaded a new document , you can download it from this link

http://www.microsoft.com/en-pk/download/details.aspx?id=11094

{ 0 comments }

How to get Standard SQL out from Query Object in AOT?

by alirazazaidi on August 15, 2014

We can get standard sql from AOT Query object through X++ code.

Following X++ Code used to get Standard Sql out of EcoResProductListPage

 

EcoResProductListPage

static void Job2(Args _args)

{

Query query;

query = new Query(queryStr(EcoResProductListPage));

info(query.dataSourceNo(1).toString());

}

QueryInfo

 

{ 0 comments }

Updated version for “Inside Microsoft Dynamics Ax 2012” is now out. It is updated for AX 2012 R3 version.

What’s new :Inside Microsoft Dynamics AX 2012 R3

  • It include a new chapter about developing companion apps.
  • It include a new chapter about application life cycle.
  • A new sections about LINQ support and print management.

 

You can purchase inline from:

 

 

 

{ 0 comments }

Clear the Cache on all clients Dynamics Ax 2012

by alirazazaidi on August 10, 2014

Last week I post a solution to problem of old code on Dynamics Ax 2012 Client, That work for single client and it is not possible to clear cache on manually on every client. Later I found better solution to reset the client cache at AOS. Reference is

http://thwidmer.wordpress.com/2010/05/19/reset-program-cache-file-for-all-clients/

According to that reference we have to reset the GUID, so all Clients have to reset its cache, this method required AOS restart.

static void ResetAUC(Args _args)
{
#AiF
SysSQMSettings _Settings;
;
ttsbegin;
update_recordset _Settings setting GlobalGUID = str2Guid(#EmptyGuidString);
ttscommit;
info("Now we have to Restart the AOS Service to use a new GlobalGUID.");
}

Its works for me.

{ 0 comments }

Little bit taste of List In Dynamics Ax 2012

by alirazazaidi on August 5, 2014

In Dynamics Ax List is used as collection, You can add , remove or update elements in it. Type of list is define at the time of its declaration and cannot be change after initialization.

We can iterate in List with the help of ListIterator object, which have several methods to process on list.

   
 List           intList       = new List(Types::Integer);
    List           strList = new List(Types::String);
    ListIterator   literator  

    // add the element at the end of the list
    intList.addEnd(123); 

    // add the element at the start of the list
    intList.addStart(321); 

    intList.addEnd(300); 

    strList.addEnd ("Raza");

    strList.addStart ("Ali"); 

    strList.addStart ("Zaidi"); 

    // If you want to insert the data at some specific index, then you need to make use of the listIterator class 

    // Iterator performs a midpoint 

    // insert at current position. 

    literator = new ListIterator(strList);
    while (literator.more())
    {
        // can provide some condition, i.e. if check etc
        if (literator.value() == "Ali")
        {
            listIterator.insert ("Between Raza and Zaidi");
        }
    }

{ 0 comments }

My friend Bashir Ahmad Malik got following error during start up dynamics Ax service.

 

“The Microsoft Dynamics AX Object Server 6.2$01-MicrosoftDynamicsAX service terminated with service-specific error Code 90.
Suspect state of SQL Server database is a state when you are unable to connect to the database. “

 

During trouble shooting we find following root causes.

 

  • database is corrupted
  • database files are being “opened” or held by some process (operating system, other program(s)…)
  • not enough disk space for SQL Server
  • insufficient memory (RAM) for SQL Server
  • unexpected SQL Server shutdown caused by power failure

 

we solve this problem by following Sql Script.

  1. Connect database server with Microsoft SQL Server Management Studio.
  2. Execute the following SQL script in given order:

NOTE: replace [DatabaseName] with your database name

-- This query will rollback any transaction which is running on that database

-- and bring SQL Server database in a "single user" mode

ALTERDATABASEMicrosoftDynamicsAX SETSINGLE_USER WITHROLLBACKIMMEDIATE

 

-- Marking database READ_ONLY, disable logging,

-- and limiting access only to members of the sysadmin fixed server role

ALTERDATABASEMicrosoftDynamicsAX SETEMERGENCY

 

-- Checks the logical and physical integrity of all the objects in the specified database

DBCC checkdb(MicrosoftDynamicsAX)

 

-- In case of simple failure then we can use allow data loss option to recover Database

 

--  DBCC CheckDB (MicrosoftDynamicsAX, REPAIR_ALLOW_DATA_LOSS)

 

-- Set database accessibility to it's original state, allowing all logins

ALTERDATABASE MicrosoftDynamicsAX SETMULTI_USER

EXEC sp_resetstatus MicrosoftDynamicsAX


reference : http://social.technet.microsoft.com/wiki/contents/articles/25820.repair-a-suspect-database-in-sql-server.aspx

{ 0 comments }

Dynamics Ax 2012 Client cache problem

by alirazazaidi on August 3, 2014

A few days ago, I was working on Dynamics Ax 2012 customization. When I shifted code to QA server, Compile, Generate CIL, but no changes display on client. I was shocked, latest code working fine on my machine but why it is not working on QA server. AOT shows the latest code. During troubleshooting I found that it is due to Client Cache.  For this I have to delete cache files form cache folder. AX cache files have “auc” extension.

 

I found auc files from following folder

C:\Users\aliraza.zaidi\AppData\Local\

 

I perform following steps.

  1. Close Client on machine.
  2. Stop AOS service.
  3. Delete all auc files from local cache folder.
  4. Restart AOS.
  5. Open client.

 

I found latest code working fine on QA server.

{ 0 comments }

Getting Count in X++ using Select statement

by alirazazaidi on July 27, 2014

Hi, You can get Count X++ select statement as

 

/// <summary>
/// Get resource poool count.
/// </summary>
/// <returns>
/// resource pool count.
/// </returns>
protected int getResourcePoolCount()
{
select count(Rank) from resourceTable
where resourceTable.UserSession == _userSession
&& resourceTable.ResourceSet == ProjResourceSet::Pool;

return resourceTable.Rank;
}

{ 0 comments }

If analysis services are not deployed on machine, then deployed it and select analysis services from sql server installation wizard.

Insdy

 

After installation, Please verify that sql server analysis services are running in services.

 

 

Analysis services services

 

Run the Dynamics Ax 2012 R3 setup to install the Analysis services component.

 

Setup Dynamics Ax

 

 

Validate the prerequisite and if they failed install the prerequisites

 

successful Vaildation

 

During installation wizard select the service name.

 

7-20-2014 11-10-07 PM

 

 

 

Select the AOS server name and database. if default then set to Dynamics Ax

 

 

 

 

 

7-20-2014 11-10-29 PM

 

 

 

 

Setup complete

 

 

Now open the dynamics ax 2012 Client and form file menu ==> Tools ==> Business Intelligence ==> sql

 

Wizard

 

 

select next

wizard1

 

Select the Deploy option

Deploy

 

deployOptions

Deployment process

status

Deployment process took 1 hour on my machine.

Deployment

Deployment are successfully install on my machine.

image21

{ 0 comments }