Tuesday, 19 January 2016

Get current user name x++ AX 2012

when it is require to show current user name related with worker try below code in AX 2012.

static void getUserName(Args _args)
{
    info(strFmt('%1',curUserId()));
    
    info(strFmt('%1',HcmWorker::userId2Worker(curUserId())));
    
    info(HcmWorker::find(HcmWorker::userId2Worker(curUserId())).name());
}


This helped you..!! Then comment below..:)

Create Custom lookup x++ ax 2012

Create lookup on x++  AX 2012

Many time there is client's requirement of lookup to have specific fields from the table in Dynamics AX 2012.

try code below to create custom lookup.

Right click on the field and create lookup method and write the code as below.

public void lookup()
{
    Query                   qr = new Query();
    QueryBuildDataSource    qbds;
    QueryBuildDataSource    qbdsJoin;
    QueryBuildRange qbr,qbr1;

    QueryRun                qrun;
    SysTableLookup          sysTableLookup = sysTableLookup::newParameters( tableNum(ProjTable), this);
    ;
    qbds= qr.addDataSource( tableNum(ProjTable));
    qbds.joinMode(JoinMode::InnerJoin);
    qbds.relations(true);    
    
    sysTableLookup.addLookupfield( fieldNum(ProjTable, ProjId));
    sysTableLookup.addLookupfield( fieldNum(ProjTable, Name));      
    sysTableLookup.parmQuery(qr);
    sysTableLookup.performFormLookup();

}


This helped you..!! Then comment below..:)

Monday, 18 January 2016

Management Reporter versions


I am starting to do some work with Management Reporter, so I thought it would be useful to have a list of the versions for various service pack levels. If anyone has other versions, please let me know and I will update this list.

Management Reporter 2.0

SP 1
2.0.1663.3
FP 1
2.0.1664.19
SP 2
2.0.1700.31
SP 2 Update
2.0.1700.66

Management Reporter 2012

RTM
2.1.1026.37
RU1
2.1.1028.0
RU2
RU3
RU4
RU5
CU6
2.1.6041.36
CU7
CU8
CU9
CU10
CU11
CU12
CU13
2.12.13002.1

Saturday, 2 January 2016

UTC date time to String X++ AX 2012

UTC date time to string x++ AX 2012


    utcDateTime utc;
    str         strdate;
      
    utc = DateTimeUtil::newDateTime(mkDate(15,12,2012),0);
   
    info(strFmt('UTC date: %1',utc));
    strdate = DateTimeUtil::toStr(utc);
   
    info(strFmt('String: %1',strdate));

Friday, 1 January 2016

Data update batch job in waiting status Microsoft Dynamics AX 2012

Data update batch job in waiting status AX 2012


While AX 2012 upgrade steps in Data upgrade checklist AX 2012. it is required to follow checklist steps without skipping.

In Pre-Synchronization step, Many times it happens that Dataupdate batch jobs is scheduled to run. But it goes in waiting mode for long time. For that verify below setups

·         System service accounts
o   enter admin user in the business connect
·         Server configuration
o   Select ISBATCH for the current AOS server
o   Verify that the Batch groups to process are in selected group under Batch server groups tab
·         Batch group
o   Check that dataupdate group is available
o   Batch server tab, assign the current active batch server is in selected group

Now if everything looks perfect then also batch not showing executing,
Two options to follow

1)      Update batch server id from SQL
2)      Delete all batch job and recreate

1)      Update batch server id from SQL
               
                It’s time to go backend (SQL)

Go to SQL server management studio and create new query selecting AX database.

Select * from Batch

Select * from BatchJob

If you find any rows showing old ServerID then update it

update batch set SERVERID = '<01@NewAOS>' where serverid = '<02@OldAOS>'

Wait for few minutes and check that any batch showing in executing or ended.

2)      Delete all batch job and recreate

If still not running the any batch on option 1. Just delete all batch jobs. Take backup before deleting.

Run the Pre-Synchronize form again from checklist. Load scripts and click on RUN.

Open batch job form and review the batch running or not



This helped you..!! Then comment below..:)