Sunday, June 19, 2011

Update - Tip - Visual Studio 2010 Ultimate and Dynamics AX .Net Business Connector Compatibility Settings

Issue:

I bumped into this error when building my .Net app (using Visual Studio 2010 Ultimate)  which consumes Dynamics AX 2009 (.Net Business Connector assembly)

 Solution -

Update - In my specific scenario, I'm not leveraging any of the .Net 4.0 Framework features, so I just changed the Framework Version to 3.5 to make this work.



But, if you are targetting .Net 4.0, you need to perform an additional change in config after you change the Framework version to 4.0 otherwise you will run into the following error:

"Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information"

In order to fix this error, just add this specific entry in your app.config under configuration section:
startup useLegacyV2RuntimeActivationPolicy="true", so now your modified app.config should look like the below:

And you should be good to go now with .Net 4.0!

P.S Florian has a theory on .Net 4.x compatibility with AX 2009 BC in his blog , but without making this additional change in config as I have shown above, it won't work and as said before I was just using a basic .Net 3.5 targetted app just to test one of my AX BC Classes

Wednesday, June 8, 2011

Tip - Maximizing Performance of Master Scheduling Job

Issue - We had this issue where Master Scheduling nightly batch job was taking more than 3-4 hours to complete.

Solution - Set up the Helpers count to a number more than 0, in our case 8 was a decent figure as it reduced the job completion time from 4 hours to 45 mins. By setting the helper count, it spawns into multiple threads/multiple tasks thereby making the job quicker.


Tip – EP Customization ( Dynamically Loading Report Folder from Network based on Store Parameter)


Overview
I had this requirement where based on the logged in Store Number, the user should be able to open the corresponding Report Store Folder (located in an UNC Network Path) from Enterprise Portal web page

Solution/WorkArounds:
Initially, tried writing a separate web part which loads a .Net File Dialog user control box but it was turning out to be complex so left the approach as time was limited
Then, tried the out of the box Page Viewer Web Part but it has the limitation wherein you can't dynamically load the network path and in order to attain it, one needs to write a custom Dynamic Page Viewer Web Part which is another time consuming and complex customization.
After some investigation, I found a much simpler way to achieve this.
  1. Wrote a dynamic Java Script which queries the Network Path from AX Table
  2. Pass the store parameter to it
  3. Loads the UNC Path dynamically on the fly based on the store parameter
This is the code segment which picks up the Network Path and then dynamically appends the store id to it based on the logged in user's store id profile

  
Tip: Initially, I was using the ClientScript.RegisterStartupScript method to register the script block but landed into the same issues this bloke was facing when trying to load from webpartzone.
, ScriptManager came to my rescue here.
Below is the button in action on our portal Site (Role Center Page) which loads the network Report path