axCoder

Microsoft Dynamics Ax developer's blog

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