Wednesday, April 8, 2015

AX2012 : Troubleshooting SSRS error "The socket connection has been disposed. Object name:'System.ServiceModel.Channels.SocketConnection'"

Hi Friends,
Recently we faced issue at one client using AX2012 FP CU4 , on running the below standard AX reports, we had no customizations in these reports and other reports in systems were running fine:
·        General Ledger > Reports >Project > Transaction >Ledger updates -Consumption report
·        General Ledger > Reports >Project > Transaction >Ledger updates - on-account transactions.



The reports were running fine when executing for shorter date ranges so we were having doubt that the report rendering was getting timed out due to large volume of data.

On searching in LCS, my doubt was confirmed as  I found resolution for the same error message, for customer ageing report, below is link:
https://fix.lcs.dynamics.com/Issue/Solution?bugId=3129125&qc=6948a944b173c583fdcf4eb33265edcd

We have to increase the default SSRS timeout configuration settings on the report server, server configuration and business connector configuration on the SSRS server. The below link from Dynamics AX BI team which has more details on how to do it:
http://blogs.msdn.com/b/dynamicsaxbi/archive/2013/02/14/how-to-addressing-ssrs-session-timeouts.aspx

If you are facing the same error then worth trying this out.  Have a great day.

Friday, February 20, 2015

AX2012 R3: Technical overview of developing new RF processes

Hi Friends,
AX 2012 R3 comes with out of the box warehouse mobile device portal which can be accessed via mobile devices. 
If you are working on a development task to create new/extend existing RF screens then here are some basic design principles which should be kept in mind throughout the development process:

1. RF processes are small and clear tasks. So be very clear about what process needs to be build. Discuss and brainstorm with consultant to make the process crisp, clear and user friendly.

2. There should be a clear division of  the complete process into steps. This is important not only from understanding point of view but also in order to do the development of the classes as the framework classes  require you to set the process stage every time a scan is done.

3. Create a  process flow diagram of the process. This helps to visualize the process more clearly.

Moving on it is very important to understand how the technical architecture for this framework works. Here are some key points:

  • The class controlling the RF screens behaviour is WHSWorkExecuteDisplay. Every RF process class extends this class. So if you are on the way to create your custom screens then you know the first point. Your new class needs to extend WHSWorkExecuteDisplay class.

  • This is an abstract class, note that there are variable which hold the step and pass information, these play very important role in developing the process.



  • Another important class in this framework is WhsRFPassthrough. It maintains the complete information of values stored in all the process variables at each step.

  • Apart from extending this class there are 2 more enums which you need to modify to plug in your new process:
    • WHSWorkExecuteMode
    • WHSWorkActivity.


  • There are few methods in WHSWorkExecuteDisplay class which are of quite importance as you can model you process just by overriding these methods and understanding how they work.
  • displayForm() is an abstract method in this class. When you override it, the below things are done:
    • You build the container
    • Set the process step inside this method
Refer to any standard AX class where this method is overridden to get an idea of how to model this function.
      

  • It is based on containers and maps. 
  • Map named pass in class stores all the control values. 
  • Values/selections are all stored and then processed at run time. 
  • There are no form designs, all the magic is happening inside the classes using X++ code.

For example the below code from WhsWorkExecuteDisplayProdStart class gives an idea of how to build this method:





There is a great article written by Alex Anikiev which can be found here to show how we can leverage the existing architecture to create new custom RF screens. The above basic idea of how the classes work should make the overall understanding more smooth.

Let's also take a look at the setup required to use the RF screens. The setup is very simple:
1. Setup Mobile device menu item --> All menu items on RF menu need to be defined on this form. It can be accessed from Warehouse management -> Setup -> Mobile device -> Mobile device menu items





2. Setup mobile device menu : On this form you can set up the different menus that will be displayed on the mobile device. This form can be accessed from Warehouse Management > Setup > Mobile Device > Mobile Device Menu and is very straight forward to configure.


3. Setup user worker: We need to set up a user ID for workers who will be using the mobile device. This can be done from Warehouse Management > Setup >Work User > Worker screen. You will need to define the setup for the worker attached to your AX user. Here you can select the default warehouse and the default main menu for the user.



You are done with the required setup and can start using the RF screens and explore the possibilities.

Wednesday, February 4, 2015

AX2012 R3 : Troubleshooting customized SSRS reports deployment error after AX2012 R3 upgrade

Hi Friends,
After upgrading an AX2012 R2 environment to AX2012 R3, I was getting the below error on deploying the customized reports. Although, I verified that the reporting services extensions were installed, report server was configured properly and I was able to deploy the standard reports without any errors, I was still getting the below error on deploying the customized reports:





In order to fix this error:

1. Export the SSRS report object as a XPO.

2. Open the XPO in notepad.

3. Search for text "Version" and replace version values from 6.2.0.0 to 6.3.0.0 towards the end of the file, shown below:




4. Save the changes in XPO and import it.

5. Deploy the report.


So if there are couple of reports, then export all of them together in in XPO and replace the text 6.2.0.0 to 6.3.0.0 and then import all the reports in one go. Of course, no need to mention that it's always worth taking backups before doing such tasks ;).


 

Friday, November 21, 2014

AX2012: Troubleshooting "ERROR: Cannot find index PK_ModelSecurityPermissionCache_RECID"

Hi Friends,
Recently while importing model store in AX2012 CU4 environment, I got the below error:


To resolve this, run the axutil schema command.


After executing the axutil schema command, the model store import worked fine. If you are also facing such issue then worth trying this. It reinitializes the default model store.

More details regarding this can be found at the below MSDN link:
http://technet.microsoft.com/en-us/library/hh433540.aspx


Friday, October 24, 2014

AX2012 : An hour of SSRS error [;]

Hi Friends,
Recently we faced this SSRS issue in one of the clients environment running AX2012 CU4. This issue has strange definition:
  • Comes whenever we restart AOS.
  • Automatically gets fixed after almost an hour after AOS restart.
  • Either of the below 2 errors used to come on running any SSRS report
  • SSRS error 1 - "Access denied. You do not have sufficient authorisation to modify data in database". 

  • SSRS error 2 - " Access denied to field Company (dataAreaId) in table". 

Initially it looked like a security issue but this error was coming with system administrator roles and all the security setup was verified to be correct.

The system was configured with 6 AOS'es. One AOS was a dedicated batch server and the remaining 5 AOS were part of AOS cluster.
The solution found was that the business connector configuration on the SSRS server was pointing to AOS which was a dedicated batch server. It needs to point to an AOS which is a part of AOS Cluster. 
We created a new business connector configuration on SSRS server and pointed it to an AOS which was part of AOS cluster and it solved the issue.

If you are facing similar scenario then make sure that the business connector is pointing to an AOS from cluster. In case you also make changes to an existing AOS cluster then take care of this point.

Thanks for reading the blog and keep sharing.



Monday, October 13, 2014

Generate code using editor scripts and be more productive

Hi Friends,
Time is one of the most important factor in today's world. We develop many customizations for customers to save there time by reducing the number of clicks and automating the business processes.

There are tools available to save some time for developers too, to enable us to focus on coding the main logic rather than writing the pre requisite code to implement the logic.

One of such powerful feature is provided by editor scripts in AX. The good thing is that these classes can be enhanced to create your own custom code scripts. It is much more powerful then a template because you can add the extra pinch of run time magic.


Partners leverage these classes worldwide and extend them for variety of purposes. One of the very common use is to insert code comments. This is not a new tool and there are many good online resources already available. My intention is to share how we can use it to avoid overhead of writing too much of code.

So let us take an example. If you have to write X++ code to use a query class object for salesTable and have to add range on a field, then at-least you need to write 13-14 lines of code as shown below

By enhancing the code script classes you can achieve this just by a click of button! To achieve this I created 2 new methods in the system. One in EditorScripts class and another in XppSource class. After modifications I can see a new "query" option in editor scripts as shown below:


On selecting this option, system prompts me to enter the table name and the field name on which I want to apply the range.


Once I click OK, the code is automatically created for me.



Once I get the base code, I can further modify this as I want to implement my logic.

Below are the functions I added:
1. New method in EditorScripts class.

2. New method in XppSource class


You can download the XPO of the above modification from here.

The main idea is to save time by creating your own custom editor scripts which can help you to quickly generate pre defined code blocks at run time, so that you only spend time in writing the main logic.
Benefits of using this is approach:
1. Saves time and be more productive.
2. Avoid any typo errors.
3. You no longer need to shift your focus from your core logic to find the code pattern.
4. It is more efficient than Copy/Paste as you don't have to change the variable names and update all occurrences of those variables.

Some of the other ideas where you can extend these classes are:
  • Create find(), exists(), findRecID() methods on your tables. Refer to this nice blog by Joris de Gruyter here.
  • Create lookup methods.
  • Inserting code comments - here
  • Writing SQL statements which are required on day to day basis. For example: you can build your template for select statements using different keywords like crossCompany, firstonly , exits joins. etc.
  • Declaring/initializing set,lists, maps and there enumerators.
  • Create data contracts methods.
  • Declare Macros, Current versions, Current lists in class declaration.
  • Creating display methods - Refer to this nice blog by Micheal Brown here
If you are using these classes for any other purposes, please do leave your comment and share your bright ideas. 


Friday, September 19, 2014

Active project contracts in Microsoft Dynamics AX 2012 R3

Hi Friends,
In Microsoft Dynamics AX, project contracts are created to setup the funding sources, define funding limits on the funding sources, maintain uniform invoicing procedures and also for invoicing one or multiple projects at a same time. These can be found at Project management and accounting > Common > Projects > Project contracts.


In AX2012 R3, on the project contracts list page, you will find filter to show the contracts which are "Active". This filter is not available in previous versions of AX and caught my attention when I opened this list page in R3 environment.



Eager to know what is an active project contract, I jumped into the technical artefacts of this list page and found that active project contracts are those which are defined on a project whose status is not completed. So after creating a project contract we do not need to set it as active. There is no field in project contracts table which stores this value. It is considered active as soon as it is defined on any 'not completed' project. 

Note: This filter is not available on EP. It is only shown on the AX client.

The way standard AX does this filtering is interesting and different from the traditional way of creating such filters. This prompted me to write the post :).

1. The display target property of the filter group is defined as client. As a result, this feature is only available on AX client. Also, we can override method on the controls inside this group. 



2. If the value on the 'show contract' control is selected as "Active", then the datasource "ProjTable" of the query object is enabled. 


3. Nothing special till now. Let's look at the query used on the list page. Note that the "ProjTable" is not defined as a datasource on this query.

4. So now things become interesting! When is the data source "ProjTable" added in the query? To find this, let's check out the interaction class used in the list page. Interaction class name can be checked from the property of the list page: 


Look at the initializeQuery() method of the interaction class, you will find the below piece of code which is doing the little magic and making the whole thing interesting to share: 

















  1. "ProjTable" data-source is added in the query as a datasource.
  2. Using sysDictRelation classes, the relation is defined between data-sources of projTable &  ProjInvoiceTable.
  3. The join mode is set as "Exists Join". 
  4. The range is defined on ProjTable status field as "Not Completed".  Note the queryNotValue function used in defining the range.
  5. The data-source is enabled/disabled on the 'show contract' filter control value.
The above code is a good example to understand how we can add relations and use exists join in query data sources. This approach is also helpful if we need to do a similar customization.

To read more about project contracts refer to the technet link Project contracts

Thanks for reading the blog.