Saturday, April 26, 2014

Upgrade SSRS reports from Dynamics AX 2012 to AX 2012 R2

Sometime upgrade from Dynamics AX 2012 to AX 2012 R2 is really painful specially when we have huge customization on existing object related to EP, SSRS reports and of course Forms. I got following error when i tried to deploy some modified report which upgrade to R2:

Error      Message (12:17:24 pm) An error occurred while deploying the report ProjListTransProj. 
This might be because the SQL Server Reporting Services extensions have not been installed on the report server, or configuration information has not been entered in the Report Servers form in Microsoft Dynamics AX.

Error      Message (12:17:24 pm) System.Web.Services.Protocols.SoapException: Error while loading code module: ‘Microsoft.Dynamics.Framework.Metadata.AX, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’. Details: Could not load file or assembly 'Microsoft.Dynamics.Framework.Metadata.AX, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
   at Microsoft.ReportingServices.WebServer.ReportingService2005Impl.CreateReport(String Report, String Parent, Boolean Overwrite, Byte[] Definition, Property[] Properties, Warning[]& Warnings)
   at Microsoft.ReportingServices.WebServer.ReportingService2005.CreateReport(String Report, String Parent, Boolean Overwrite, Byte[] Definition, Property[] Properties, Warning[]& Warnings)

Info        Message (12:17:24 pm) Report name: ProjListTransProj
Design names: ProjListTransProj.Report
Deployment status for design names: Error
Assembly names: ProjListTransProjReport.BusinessLogic.dll, DrillThroughCommon.dll
Deployment status for assembly names: Success, Success

One solution if this error is to open respective VS report project in VS environment and build it and deploy it. But in some cases its not working. 
so the other workaround is to hack the code, you should export the report which throw above error, and open the XPO in notepad and search the tag 6.0.0.0 and replace it with 6.2.0.0. You should also search tag "6.0.14.0" and replace it with "6.0.15.0".
Here is the sample:
#
#    Microsoft.Dynamics.Framework.Reports, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
#    Microsoft.Dynamics.Framework.Metadata.AX, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

to replace with:

#
#    Microsoft.Dynamics.Framework.Reports, Version=6.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
#    Microsoft.Dynamics.Framework.Metadata.AX, Version=6.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

Happy Daxing

Monday, April 14, 2014

Create sales order from sales quotation

Following code is used to create sales order from sales quotation:
static void createSalesOrderFromQuote(Args _args)
{
    SalesQuotationTable             salesQuotationTable = SalesQuotationTable::find("quotation Id");
    SalesQuotationEditLinesForm     editLinesForm;
    ParmId                          parmId;
    
    editLinesForm = SalesQuotationEditLinesForm::construct(DocumentStatus::Confirmation);
    
    parmId = editLinesForm.parmId();
    
    editLinesForm.initParmSalesQuotationTable(salesQuotationTable);    
    editLinesForm.parmTransDate(systemDateGet());
    editLinesForm.prePromptInit();
    editLinesForm.initParameters(NoYes::No, NoYes::No, NoYes::No, NoYes::No, NoYes::No, '', NoYes::No); 
    
    editLinesForm.run();
}

Happy Daxing !!!

Friday, February 28, 2014

Development patterns in Microsoft Dynamics AX 2012

To choose the appropriate programming model and tools for your business application development, you must first identify the basic development patterns that can be combined to create your application. Development patterns are the building blocks of any business application, and they fall into the following categories: 
  • Customization 
    • Alteration 
    • Extension 
    • Enhancement 
  • Integration 
  • External application module development 
    • Custom dedicated applications development 
    • Report development 
    • Enterprise Portal Web application development
Although real-life applications rarely fit neatly into a single development pattern, it is possible to identify large parts of an application that fit into one of these development patterns. It is important to understand these pattern categories, because each of the following programming models in Microsoft Dynamics AX is best suited for to one of these development patterns. The following sections provide definitions and an example of each development pattern.
 

1. Customization

Customization is the development pattern in which you create new functionality by altering, extending, or enhancing the functionality in the shipped product. 

Alterations to the base functionality are achieved by changing the metadata and source code of the base application. This is done through the alteration of artifacts such as X++ classes, tables, and Visual Studio projects in a higher layer, such as, for example, the ISV layer or the VAR layer. The unique layering feature of Microsoft Dynamics AX enables the system to synthesize the final application logic to be executed at run-time by aggregating the metadata and code modifications across all the layers. You should be aware that this layer-based customization capability is applicable to all artifacts stored in the Microsoft Dynamics AX model store, including the Visual Studio project artifacts.


Extensions to functionality are achieved by incrementally increasing base functionality by adding to the source code in the business logic of the base application. 


Enhancements to the application are achieved by adding new functionality originally unavailable in the base application. Typically, an enhancement is larger in scope than an alteration or extension. An example of customizations would be a scenario in which a new regulation from the government requires the existing sales tax computation business logic to reflect the inclusion of an additional “environmental sustainability tax” component. If the calculation behind this new component is straightforward and simple, you can simply alter the base tax computation logic in a higher layer and directly implement the required source code changes. However, if this tax module has business rules that are more complex, you should consider enhancing the base product with a new tax engine component that implements these requirements. 


2. Integration 

Integration is the development pattern that involves enabling existing applications (not written exclusively for Microsoft Dynamics AX) to interact and work with Microsoft Dynamics AX across process boundaries. An example of integration is when a value added reseller (VAR) integrates with an existing legacy Customer Relationship Management (CRM) system to synchronize the customer list between Microsoft Dynamics AX and the legacy CRM system.


3. External application module development 

The development pattern for application modules that run out-of-process of the AOS server or Microsoft Dynamics AX client processes. 

Custom dedicated application development is the development pattern that builds a new, custom external application/client that accesses functionality and data in the Microsoft Dynamics AX system. These applications can span multiple platforms and programming languages. 
An example of custom dedicate application development is creating a Windows Phone 7 application to view open sales orders in Microsoft Dynamics AX.

Report development is the development pattern that creates custom reports and customizes any out of the box reports for the Microsoft Dynamics AX platform. 

Enterprise Portal web application development is the development pattern that creates web applications specifically built on the Microsoft Dynamics AX Enterprise Portal development framework. 
An example of web application development is creating an Enterprise Portal-based employee self-service page to enter time-sheet data. 


Thursday, February 27, 2014

The Table.Field does not have a corresponding parm-method on the AxBC-class

If you add new field in a table and getting "The Table.Field does not have a corresponding parm-method on the AxBC-class" error message, you can run following Job to fix this issue. This job will add corresponding parm-method for newly added field in a table.

static void CreateAxBCParmMethodJob(Args _args)

    axGenerateAxBCClass axGenerateAxBCClass; 

    axGenerateAxBCClass = AxGenerateAxBCClass::newTableId(tablenum(CustTable));
    axGenerateAxBCClass.run(); 
 
}



Happy DAXing !!!!

Friday, January 24, 2014

Get Budget plan Ledger dimension from value

We can use following code to get Budget plan ledger dimension.

Container           offsetAccount;
RefRecId            ledgerDimension;

// offsetAccount = ['Account structure display value','Account structure', 'No of dimension', 'MainAccount','MainAccount value','Dimension 1', 'value', 'Dimension 2', 'value'];
offsetAccount = ['SCUS - Exp & Rev','SCUS - Exp & Rev', '3', 'MainAccount','1101','Fund', '1', 'Department', '0010'];

ledgerDimension = AxdDimensionUtil::getBudgetPlanningAccountId(offsetAccount);
info(strFmt("%1", ledgerDimension));




Friday, December 20, 2013

Magic of TAB key - Code Snippets in Dynamics AX 2012

If you are new in AX development or wants to do quick development by utilizing all intenseness feature given by Dynamics AX, you can achieve it with short hand written and a TAB key. For example if you want to find/use FOR LOOP in Dynamics AX, you can just type "for" (without quotes) and press Tab button, you will see full FOR loop syntax like below:

for (;;)
{

}
similiarly if you want to find the syntax of "while select" query, you can do it by typing "whileSelect" (without quotes, and a capital S this is case sensitive) and press Tab key/button, it will display you full "while select" statement like below:

while select 
where 
{

}

Happy DAXing !!!!