16 Feb 2016

Run a form automatically when opening dynamics AX + 2012

Create a new  menu item for the form which form you want run opening dynamics AX.


Call that method as shown in below

new MenuFunction(menuitemDisplayStr(YourMenuItemName), MenuItemType::Display).run();

Place this code to Info.startupPost() (if you want it to start when the client starts) 
                                   or 
Info.workspaceWindowCreated() (if you want it to start every time new workspace is opened).

3 Feb 2016

Create a link in info log to maintable + AX 2012


Today I come across a user requirement , that user need a link on info log for go to main table. 


static void Axaptaexplorerinfo(Args _args)
{
    CustAccount     custAccount = "C00001";
    CustTable       custTable;
    args            args = new args();
    SysInfoAction_FormRun    infoAction = SysInfoAction_FormRun::newFormName(formStr(CustTable));
    ;
    custTable = CustTable::find(CustAccount);
    args.record(CustTable );
    info(strFmt("Custaccount id  %1",CustTable.AccountNum),"",SysInfoAction_TableField::newBuffer(CustTable));


}

4 Jan 2016

Finding Formdatasources through X++ in AX 2012

static void LegenderFormDataSourcesFind(Args _args)
{  
    FormRun formRun;
    FormBuildDataSource formBuildDataSource;
    int i;
    Args args = new Args();
    args.name("SalesTable");
    formRun = ClassFactory.formRunClass(args);
    for(i=1 ; i<=formRun.form().dataSourceCount();i++)
    {  
       formBuildDataSource = formRun.form().dataSource(i);
       info(new DictTable(formBuildDataSource.table()).name());
    }
}

Create number sequence in D365 FO

Create the data type. Add code in the loadModule method of the appropriate NumberSeqModule subclass. Add a method to the module’s paramet...