Tuesday, June 27, 2017

AX2012 R3: E-Learning Links

Microsoft Learning Official Courseware:
Warehouse Management Official Course: https://dynamics.microsoftelearning.com/eLearning/courseDetail.aspx?courseId=450776
Transportation Management Official Course: https://dynamics.microsoftelearning.com/eLearning/courseDetail.aspx?courseId=450777
Tech Conference and other material on InformationSource:

Easy way to get SID for Microsoft Dynamics Ax

Most of the time when we restore other developer database ,or Client database 

Unable to log on to Microsoft Dynamics AX” error message when opening the AX client”

   we want to get the SID for the current user setting, here are the steps you  can perform to successfully log on to Dynamics AX:
1. Open the command prompt and type "wmic path win32_useraccount where name="{Domain user name}" get sid"  Press Enter
                                               OR
    Run CMD as administrator and write command "WHOAMI /USER" it will return SID

2. Copy the SID.
3. Open the SQL server and write following command to update current admin user:

             use {AX DB}
             update USERINFO
             set SID = '{paste the SID here from step#2}', NETWORKDOMAIN='{Network domain}',         NETWORKALIAS='{User Id}' where ID='Admin'

OR 

3. You can find UserInfo table under Microsft Dynamics AX 2012 Database.
     (a). Right Click on table node --> select Edit rows -- > Update SID where ID = Admin
     (b) Replace  Network Alias   with your user domain name example "Daniyal.aslam" in               my case.
     (c) Replace NetworkDomain  with your domain name example "abc@contoso.com" in               case when we copy database from Client or Live environment where domain name is             different from Production environment

Create Inventory External Journal Through x++

Create Inventory External Journal Through x++

Here is the code for creating External journal in Dynamics Ax 

static void CreateInventExternalJournal(Args _args)
{
       InventJournalTable inventJournalTable;
       InventJournalTrans inventJournalTrans;
       InventJournalName inventJournalName;
       InventDim inventDim;
       JournalCheckPost journalCheckPost;

//Below code creates journal header
       inventJournalTable.clear();
       inventJournalName = InventJournalName::standardJournalName(InventJournalType::Movement);
       inventJournalTable.initFromInventJournalName(InventJournalName::find(inventJournalName ));
       inventJournalTable.insert();

//Below code creates journal lines
       inventJournalTrans.clear();
       inventJournalTrans.initFromInventJournalTable(inventJournalTable);
       inventJournalTrans.TransDate = systemDateGet();
       inventJournalTrans.ItemId = "000004";
       inventJournalTrans.Qty = 100;
       inventDim.InventSiteId = '12';
       inventDim.InventLocationId = '1201';
       inventDim.wMSLocationId = 'BULK-001';
       inventJournalTrans.InventDimId = inventDim::findOrCreate(inventDim).inventDimId;
       inventJournalTrans.insert();

//The below code posts the journal
      journalCheckPost = InventJournalCheckPost::newPostJournal(inventJournalTable);
      journalCheckPost.run();
}

now run the job

Error when validate report server setting in Microsoft dynamics AX 2012

Hi Guys,

Today i am configuring my reporting service on AX 2013 R3 while configuring  when i validate report Server setting in Microsoft dynamics ax  i came across the below mentioned issue

"Make sure that SQL Server Reporting Services is configured correctly. Verify the Web Service URL and Report Manager URL configuration in the SQL Reporting Services Configuration Manager."

after searching on internet i have found nothing, finally wasting the whole day i got the solution myself.

Here is the solution,
Steps to follow,

1.Run Microsoft dynamics ax client with admin account "Run as administrator"
2. Now go to report server setting in system administrator and then validate settings
3. succeeded

Cause: SQL reporting server / SQL Server is install by local user not administrator
Happy Daxing,

Create Inventory Movement Journal through x++

           Create Inventory Movement Journal Through x++

static void CreateInventJournal(Args _args)
{
       InventJournalTable inventJournalTable;
       InventJournalTrans inventJournalTrans;
       InventJournalName inventJournalName;
       InventDim inventDim;
       JournalCheckPost journalCheckPost;

//Below code creates journal header
       inventJournalTable.clear();
       inventJournalName = InventJournalName::standardJournalName(InventJournalType::Movement);
       inventJournalTable.initFromInventJournalName(InventJournalName::find(inventJournalName ));
       inventJournalTable.insert();

//Below code creates journal lines
       inventJournalTrans.clear();
       inventJournalTrans.initFromInventJournalTable(inventJournalTable);
       inventJournalTrans.TransDate = systemDateGet();
       inventJournalTrans.ItemId = "000004";
       inventJournalTrans.Qty = 100;
       inventDim.InventSiteId = '12';
       inventDim.InventLocationId = '1201';
       inventDim.wMSLocationId = 'BULK-001';
       inventJournalTrans.InventDimId = inventDim::findOrCreate(inventDim).inventDimId;
       inventJournalTrans.insert();

//The below code posts the journal
      journalCheckPost = InventJournalCheckPost::newPostJournal(inventJournalTable);
      journalCheckPost.run();
}

Update label description using X++

I have requirement where i need to update label for ssrs report parameter

Here is my solution for updating label

static void updateLabelJob(Args _args)
{
    SysLabelEdit     sysLabelEditLocal;
 
    sysLabelEditLocal = new sysLabelEdit();

    info(strFmt('Before Label changes : %1', "@DAN1"));
 
    sysLabelEditLocal.labelModify('en-us',  sysLabelEditLocal.findLabel('en-us', 'Demo Parameter'),                                                          "SSRSTEST", "", SysLabelApplModule::None);
 
    info(strFmt('After Label changes : %1', "@IQL112"));
}

Synchronization through x++ code / Unable to do DB Sync through AOT

Synchronization forcefully DB through X++ 


here is the code for synchronization DB in X++.

static void DBSync(Args _args )
{
    Dictionary dict;
    int idx,lastIdx,totalTables;
    TableId tableId;
    Application application;
    SysOperationProgress progress;
    StackBase            errorStack;
    ErrorTxt             errorTxt;
    application =  new Application();
    dict = new Dictionary();
    totalTables = dict.tableCnt();
    progress = new SysOperationProgress();
    progress.setTotal(TotalTables);
    progress.setCaption("TEst");
    errorStack = new StackBase(Types::String);
    lastIdx = 0;
    try
    {
        for (idx = lastIdx + 1; idx <= totalTables ; idx++)
        {
            tableId = dict.tableCnt2Id(idx);
            progress.setText(dict.tableName(tableId));

            lastIdx = idx;
            application.dbSynchronize(tableId,false,true,false);
            progress.incCount();
        }
    }
    catch(Exception::Error)
    {
        errorTxt =  strFmt("Error in table '%1 (%2)'",tableId,dict.tableName(tableId));
        errorStack.push(errorTxt);
        retry;
    }

    setPrefix('Test2');
    errorTxt = errorStack.pop();

    while (errorTxt)
    {
        error(errorTxt);
        errorTxt = errorStack.pop();
    }
}

now run job.