среда, 28 декабря 2016 г.

How to run client with particular AOS



Recently I had a task to run AX with particular AOS on the same machine. It has 2 aos installed.
But I don't have access to Configuration utility.
So, I thought that there's a way to run ax without shortcut, but with cmd.

I goggle and found a solution which works exactly I need:

1. Open cmd  (no matter with Administration privilegy or without).
2. Go to C:\Program Files (x86)\Microsoft Dynamics AX\50\Client\Bin (the path may be different , it depends on Ax version.
3. Run AX32.exe with following parameters:
-loadbalance=0 -aos2 = "your aos instance name"
4. Press Enter.

Profit!

вторник, 4 октября 2016 г.

How to add new document into print management module

Hi All!
Recently I've faced with task which I've never done before. It's adding new document into print managment settings for certain module (in my case it was WHS module).
I tried to found any solution or advice in web but it was unsuccessfully.
Finally I found some advice regarding my issue but is was written not so good as for me.
And I decided to keep this solution in my blog so here're we go:

Lets asume that we want to add new document with "DocName" into our print management settings.

What we should do for this?
1) Go to Data Dictionary -> Base enums ->  and find PrintMgmtDocType.
2) Add new enum into this base enum with name "DocName"
3) Go to Classes -> PrintMgmtDocType
4) Find method getDefaultReportFormat()  in this class and add new case statement into it for our enum
5) Add appropriate tableId and FieldId into getQueryRangeFields() and getQueryTableId()  methods for further treatment
6) Next, add a case statement to the method getDocumentTypes() of the class PrintMgmtNode child class, i.e. PrintMgmtNode_CustTable or PrintMgmtNode_Sales or whichever node you want to add it to in the print management hierarchy. In our situation it was class WHSPrintMgmtNode_WHS.

After that you could see your document under WHS print management module settings.
But the thing is you won't be able to add Report  format value untill add it into PrintMgmtReportFormat  table manually (I haven't explanation of this yet).

After you added the value into this table - you'll be able to print your report.
Profit!

четверг, 7 июля 2016 г.

Lookup with possibility to choose color AX 2012

Hi to all!
Recently I've found kind of interesting piece of code, which allows us to choose color for row from Parameters form. You could use this parameter anywhere you want\need.
I just wanted to save this code for myself and then thought "It'd be unfair not to share it".
So, I'm going to share this code with you, hope it'd be helpful for you in your apps!

First of all, we need to create Int control on form with next properties
ColorSheme: RGB
Background color : black
Foreground color : black
Label foreground color (optional) : black
Choose datasourse and datafield if you want save this value in table

Override lookup method for this ds field\control and write next code:

public void lookup(FormControl _formControl, str _filterStr)
{
    Binary customColors;
    int             r, g, b;
    container       chosenColor;
    [r, g, b]   = WinApi::RGBint2Con(MCROrderParameters_CancelledLineColor.backgroundColor());
    chosenColor = WinApi::chooseColor(element.hWnd(), r, g, b, customColors, true);
    if (chosenColor)
    {
        [r, g, b] = chosenColor;
        MCROrderParameters.CancelledLineColor = Winapi::RGB2int(r, g, b);
        MCROrderParameters_CancelledLineColor.backgroundColor(MCROrderParameters.CancelledLineColor);
    }
}

Also, for better UI for user you could also override modified method and write next one:
public void modified()
{       MCROrderParameters_CancelledLineColor.backgroundColor(MCROrderParameters.CancelledLineColor);
for change control color immediately.

That's all probably, hope it helps you sometimes!

пятница, 17 июня 2016 г.

What is the difference between Table.data() and buf2buf methods AX 2012


Hi all,
while creating a duplicate or copy of a record , generally we use table.data() method , for passing each  field one by one. The only problem with data() method is it would copy the system fields  also line ModifiedBy, CreatedBy etc, hence if we are inserting data across companies , we can't use data() method.

So what should be the solution for this?
Dynamics Ax also provides one more generic method buf2buf(_SourceRecord,_TargetRecord) , the only difference between Buf2Buf() and data() method is that buf2buf() doesn't copy system fields, which we need :-) 

So for intercompany data inserting, we should use buf2buf() method with changeCompany() method.

Looking forward to your comments.