Translate

Tuesday, July 30, 2013

Finding the current company curreny code in AX 2012

Hello,

Here is the code to find the company currency code in AX 2012

Method 1:
currencyCode = Ledger::accountingCurrency(CompanyInfo::current());

Method 2:
currencyCode = Ledger::accountingCurrency(CompanyInfo::Find().recid);

Method 3:
currencyCode = CompanyInfo::standardCurrency();
Thanks,
Prasan

Wednesday, June 19, 2013

AX 2012 – SSRS Reporting : Selecting the report design at the runtime based on the static parameter (dialog field) values

 
Hi,

Here is a solution to select the design at the runtime based on dialog field values in AX 2012 SSRS reports. Hope this will help you.

 
Create a controller class that extends SrsReportRunController()
 
And override preRunModifyContract() in the controller() class and follow the below steps.
 
protected void preRunModifyContract()
{
    boolean     paramValue1;
    boolean     paramValue2;
 
    SrsReportDataContract dataContract = this.parmReportContract();
    SrsReportRdlDataContract contract = dataContract.parmRdlContract();
 
    paramValue1 = contract.getValue(Param1_name);
    paramValue2 = contract.getValue(Param2_name);
   
    if(paramValue1)
    {
        dataContract.parmReportName(reportname.design_1);
    }
    else if(paramValue2)
    {
        dataContract.parmReportName(reportname.design_2);
    }
   // else default design is used to display the report which is used in main(); or you can specify your design name here
}
 
static void main(Args _args)
{
    xxx controller = new xxx (); // Let us assume the current class as xxx
 
    controller.parmReportName(reportName.defaultDesign);  // Make sure you specify the default design while running the report and this is required to run the report and to get the dialog.
    controller.parmArgs(_args);
    controller.startOperation();
}
 
And now, Create the output menu item and specify the object type to class and specify the object to this controller class which we create now. And the report is ready to select the design at runtime.
Hope this will helps you,
Prasan.. J
 

Tuesday, April 9, 2013

AX 2012 - Technical best practices

Hi,

you cand find the top best practices for developement in AX 2012 here

Please Click here

Thanks,
Prasan :)