Microsoft Dynamics Ax developer's blog

Sunday, November 04, 2018

Thursday, August 31, 2017

New cloud architecture guides

MS has released new architecture guides revealing the vision how modern applications should work in cloud.

Also as there is a free course by famous Jeffry Richter about what is special in cloud that can be recommended to developers who want to get familiar with cloud concepts. 

Friday, July 10, 2015

DAX 2012 toolset

There is a project that combines most interesting known tools for Ax2012. In includes DEV_Toolbar for example. dax2012toolset.codeplex.com

Wednesday, November 19, 2014

Static code analysis using XLNT

In ax 2012 there is a code upgrade tool based on parser named XLNT - it allows to use syntax tree if X++ from .NET.

I have written a small example of static analysis for X++ based on that technology  http://1drv.ms/1u9Rs8x

It detects code patters that are likely to be copy-and-paste errors (when somebody copies code but forget to change something in a copy) like:

case X: some code
...
case X: some code

if (x) {
   y
}
else
{
   y
}



 

Tuesday, July 30, 2013

How to become an axapta administrator with powershell


$sid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value

osql -d AXDBDEV -p -E -Q "update userinfo set sid = '$sid', networkdomain = '$env:userdomain', networkalias = '$env:username' where ID = 'admin'"

Friday, April 27, 2012

Did you know, that you can drag and drop from debugger?

When I debug complex code, I open OneNote, dock it to the right border of screen and save some variables values from debugger there.
Previusly, I used copy and paste from "locals" or "watch" windows and it looked like there:

NAME:

               _closeAmountReporting

VALUE:

               128.57

TYPE:

               real
Today I've tried to drag&drop a value and it looked like there:

_closeAmountReporting 128.57   real

which is more compact and comfortable representation.

Monday, April 09, 2012

Code folding in ax 2012

As mentioned Martin Drab, editor extensions for VS 2010 work also in Ax 2012. Including code outlining example. Below is CustVendSettle.settleNow, lines 111 to 777:

Monday, February 06, 2012

DEV_Toolbar: tabax for Ax2012

I am sharing a tabax successor for Ax6 as an example of usage WPF control.

The form uses standard tab control from WPF with a custom template.

Also you can use it as an example of event handling.

The code has a problem which I can not resolve now: if you press a middle or right mouse button on a tab, vontr scrolls to the start - so you can accidentially close wrong tab. Now the workaround provided: if such event occured, event handler uses selected tab instead of tab under click

Tuesday, July 12, 2011

XRef–> DGML

image

Just updated my old sample to produce DGML in addition to .DOT, so now you can view cross-references in VS2010 interactively (filter, rearrange so on). For example picture above shows relations of LedgerVoucherObject.check



Download the job from SkyDrive:

Thursday, June 30, 2011

Tabax successor as an illustration of new dev features of Ax 2012


For some reason I've recreated some subset of tabax in Ax2012. I think it can be an illustration of some new Ax2012 features

Since I have no time for debugging learn winapi in deep I decided to use .NET framework as much as possible.

The most magic part of tabax for me is the code that creates and manages tab control to add images and change size of tabs. That code was written by AndyD from AxForum.

but...

now we have a managed host control and can just use any .NET control we want. I decided to use tab control from WPF.

I took Expression Blend and created my own template for control and implemented several templates for tabs (for example, in the screenshot above you can see blue gradient on editor tabs and darker blue gradient on selected tab related to X++ editor).

After that I copied template as avery big string to X++ method and just loaded it in ManagedHost control.

Since Ax 2012 supports events and they are seamlessly integrated with .NET there was no problems with reacting to user actions.

In addition I've found an example of drag-and-drop for tabs and translated it to X++ - now I can reorder tab pages by dragging them.

As a result I have just one form that uses only plain vannila .NET framework (no custom DLLs) all logic is implemented in X++, visual design is stored in 1 big string literal inside X++ form

Monday, November 01, 2010

the future of F#

The very interesting session from PDC10 related to the future of F# - Microsoft functional-object-imperative variance of OCAML.

They are extending application with "type providers", which allow to extend static type system of F# with dynamically generated types withoun explicit code generation - by implementation of a very simple interface.

I think it can be useful techique to implement business platforms such as LightSwitch (when it come to C#) - LightSwitch authors can just implement type provider for entities and do not generate very much intermediate code.

PS. I think there is aplso enteresting how easy Don manipulates various data in F# interactive

Friday, October 29, 2010

How to open a form in a running Ax client from an external application

Some times ago someone asks me if it possible to open form in running Dynamics Ax application with external code. He don’t want to use AxPath for some reason.
I recalled there is a similar thing in Ax (since version 4.0) – when you receive an event alert message you can click an a link and go to the corresponding alert.
The idea was to reuse alert handling code as much as possible. And I achieved that without changing Ax code at all.
How alert links work?
1. When you start Ax32.exe, it runs the EventDrillDownPoller class, that creates a named pipe with name like “Dynamics\Event\0S-1-5-5-0-686394” (you can use pipelist utility from the SysInternals suite to obtain exact name of your named pipe) where
  • Dynamics\Event\ – is a constant prefix
  • 0 – is a value from the “Drill Down target” field in the “Basic\Setup\Alert\Alert parameters” form
  • S-1-5-5-0-686394 – is a user system session ID
and then time is being initialized, handler of the timer polls named pipe and executes SysStartupCmd descendant when message received.
You can look at \Classes\EventDrillDownPoller\scheduledPoll code to see the details.
2. When you click on the link in e-mail, axhlink.exe protocol handler is executed, it parses url and connects the named pipe obtaining it’s name using “Drill down target” from url and current session id. Then it writes a command to the named pipe.
3. When timeout handler (which was subscribed to the times in 1.) detects there is a new message in the pipe, it just runs a SysStartupCmd and then recreates a named pipe (see \Classes\EventDrillDownPoller\scheduledPoll – unfortunately it uses the current company to detect a drill down target, so if you have different values of the field in different companies ad user changes the current company, you can see it recreating a named pipe with a different name – it can cause mistakes)
So the task is pretty simple
  • Create an autorun startup command configuration file
  • Connect to the named pipe using session id and provided drill down target
  • Write a zero terminated Unicode string with a startup command to the pipe
You can download code example here

Contents:
  • C# sources of sending a message  (command line utility that takes startup command and drop target ID)
  • XML file example
  • XPO with modification for autorun startup command code, adding a parameter to navigate to a specific record (that was additional requirement – it takes table and recID attributes)

Tuesday, August 24, 2010

Seattle

If you live in Seattle or know that area well, could you, please mail me mbelugin@live.ru

Saturday, June 05, 2010

Data/Control flow

I draw Data-Control flow diagrams for better understanding of some process in code. It looks something like that:

dcfd

Legend:

  • ---> – control flow
  • ==> data flow
  • Ellipsis – method
  • Rectangle – data storage
  • Rectangle with rounded corners – class
  • If ellipsis is located on the border of a class – it is a public method

Such diagrams help me later to understand place of some piece of code in some process in system.

It is critical not to draw unnecessary details on a diagram and stay focused on the current task, in other case a diagram will be unreadable. For example diagram in this post is near the edge of readability – lots of intersections are signs of it.