Thursday, 13 August 2015

Get Layer code from AXC File

Many time you have come across this situation where you have been given a development environment but you are not known about development code because of your client business policies.

Today i will tell you to how you can know about development code.
1. Go to Microsoft Dynamics AX Client Configuration.
2. Select the configuration
3. manage to export the configuration file to export to your local computer.
4. open the file as Text file.

In Client Configuration Development code can be viewed in encrypted form

5. search for "aol,text" in the axc file              aol,Text,<<Layer>>
6. Search for "aolcode,Text"        aolcode,Text,<<Development Code for the above founded layer>>

Saturday, 21 March 2015

Ax 2012 Metadata artificats


There are three artifact types that enable the sharing of Microsoft Dynamics AX metadata between environments: XPO files, model files, and model store files.

>XPO files are development artifacts. They are typically used to move metadata between development environments.
> Model files are deployment artifacts and are the recommended vehicle for distributing solutions to customers, and for deploying builds on a test or staging environment.
>Model store files contain the metadata of your entire application, including element IDs and all other element metadata. Model store files are recommended when you deploy a solution from a staging environment to a production environment. When using model store files, you must maintain common element IDs between the source and target systems, as described later in this document.



The following table describes features of these three artifact types.

XPO files
Model files
Model store files
Installation tool
Microsoft MorphX
AXUtil.exe or Windows PowerShell cmdlets
AXUtil.exe or Windows PowerShell cmdlets
The files can be uninstalled.
No, but elements can be individually deleted.
Yes
No
The files can be signed.
No
Yes
No
Element IDs are preserved in the target model store.
All elements that already exist in the model store preserve their IDs (XPO files don’t contain IDs). For new elements, new IDs are generated.
All elements that already exist in the model store preserve their IDs. For new elements, new IDs are generated.
All element IDs on the target system become equal to the IDs stored in the model store file.
Compilation is required after installation.
Yes
Yes
No
CIL generation is required after installation.
Yes
Yes
No

Friday, 9 January 2015

Simple way to import CSV File through X++

We have been importing excel file for such along time in ax. And i think this will be best example if you want to import the CSV file into AX through code.

void ImportTmpData()
{
    CommaIo          file;// = new commaIo(ItemFileName,'r');
    Container          con;
    Int                     counter;
    tmpImport        tmpImport;
    ;
   
   delete_from tmpImport;
    file = new CommaIo(fileName,'r');
    file.inRecordDelimiter("\r\n");
    file.inFieldDelimiter(",");

    if (file)
    {
        while(file.status() == IO_Status::OK)
        {
            con = file.read();
            counter++;
            if (con && counter >1)
            {
                tmpImport.field1                = conpeek(con,1);
                tmpImport.field2                = conpeek(con,2);
                 tmpImport.insert();
            }
        }
    }
}

Code to write a text file using X++

Many  time we came across situation to where we need to import data in text file.Here is a simple way to write the data into a text file.
static server void WriteTextFile(Args _args)
{ TextIo file; // Using the @ before the filename // enables us to use single path // delimiters. If you don't use it // you will have to write the path like this: FileName filename = @"c:\<<Filename.txt>>"; CarTable carTable; container con; FileIoPermission permission; #File ; try {
// Create the permission class
permission = new FileIoPermission(filename, #io_write);
// Add a request for permission before new TextIo()
permission.assert();
// Create the TextIo object
file = new TextIo(filename, #io_write);
if (!file)
throw Exception::Error;
// Specify the delimiters
file.outRecordDelimiter(#delimiterCRLF);
file.outFieldDelimiter(";");
// Loop through the data source
while select carTable
{
// Empty the container
con = connull();
// Set the data into the container
con += carTable.CarId;
con += carTable.CarBrand;
con += carTable.Mileage;
con +=carTable.Model;
con += carTable.ModelYear;
// Write the container to the file
file.writeExp(con);
}
}
catch(Exception::Error)
{
error("You do not have access to write the file to the
selected folder");
}
// Revert the access privileges
CodeAccessPermission::revertAssert();
}

Variable Symmetry has not been declared Compilation error in Ax 2012 R3

Variable Symmetry has not been declared Compilation error in Ax 2012 R3

Hello everyone,

I would like to share an information regarding Symmetry error in Microsoft Dynamics Ax 2012 R3 which come just after fresh installation . Error will be as below:

Variable Symmetry has not been declared. \Data Dictionary\Tables\PayrollEmployerTaxRegion\Methods\retrieveGNIS 12 retrieveGNIS Err:9
Variable Symmetry has not been declared. \Data Dictionary\Tables\PrlTmpGNIS\Methods\populatePrlTmpGNIS 13 populatePrlTmpGNIS Err:9
Syntax error. \Classes\PayrollCalculatePayStatementBenefits\classDeclaration 12 classDeclaration Err:9999
Syntax error. \Classes\PayrollCalculatePayStatementTaxes\classDeclaration 42 classDeclaration Err:9999
Variable Symmetry has not been declared. \Classes\PayrollSetup\refreshWorkerTaxRegionTaxes 25 refreshWorkerTaxRegionTaxes Err:9
Syntax error. \Classes\PayrollTaxCalculation\classDeclaration 7 classDeclaration Err:9999
Syntax error. \Classes\PayrollTaxEngineUtil\checkInTaxEngine 7 checkInTaxEngine Err:9999
Syntax error. \Classes\PayrollTaxEngineUtil\checkOutTaxEngine 7 checkOutTaxEngine Err:9999
Variable Symmetry has not been declared. \Classes\PayrollTaxEngineUtil\getGNISLocations 40 getGNISLocations Err:9
Variable Symmetry has not been declared. \Classes\PayrollTaxEngineUtil\getMunicipalities 39 getMunicipalities Err:9
Syntax error. \Classes\PayrollTaxEngineUtil\getPoliticalSubDivision 31 getPoliticalSubDivision Err:9999
Syntax error. \Classes\PayrollTaxEngineUtil\getPoliticalSubDivisionByTaxCode 20 getPoliticalSubDivisionByTaxCode Err:9999
Variable Symmetry has not been declared. \Classes\PayrollTaxEngineUtil\getSchoolDistricts 41 getSchoolDistricts Err:9
Variable Symmetry has not been declared. \Classes\PayrollTaxEngineUtil\getTaxEngineLocationCodeList 38 getTaxEngineLocationCodeList Err:9
Syntax error. \Classes\PayrollTaxEngineUtil\getTaxEngineVersion 10 getTaxEngineVersion Err:9999
Syntax error. \Classes\PayrollTaxEngineUtil\getTaxTableVersion 10 getTaxTableVersion Err:9999
Syntax error. \Classes\PayrollTaxEngineUtil\money2Real 11 money2Real Err:9999
Syntax error. \Classes\PayrollTaxEngineUtil\real2Hours 11 real2Hours Err:9999
Syntax error. \Classes\PayrollTaxEngineUtil\real2Money 11 real2Money Err:9999
Syntax error. \Classes\PayrollTaxEngineUtil\real2Rate 11 real2Rate Err:9999
Syntax error. \Classes\PayrollTaxEngineUtil\taxCalculation2TaxCode 11 taxCalculation2TaxCode Err:9999
Syntax error. \Classes\PayrollTaxTypeInitialization\classDeclaration 8 classDeclaration Err:9999

Scenario: 
After compiling the whole application if you get errors on tables and classes related with Standard payroll.
Then you need to follow below procedure to solve the compilation errors.

Solution:
Check whether the ste-net.dll related with payroll is available in both client and server bin.

Then in the AOT --> References node  right click and add a new reference.
click on browse and select the ste-net.dll and press ok.
Compile the classes where you are facing errors on symmetry.

Wednesday, 30 July 2014

Form letter classes and its hierarchy in ax 2012

One of the most commonly used classes in AX are the FormLetter classes. The
FormLetter classes define how to post different status updates against sales orders
and purchase orders.
The normal flow when a posting is being performed is that the parm tables are
Populated with data, and then the update itself is performed.
Below example will shows how to Post the Invoice from sales order, similar logic's can be used to post the Invoice from Purchase order.
static void postSalesInvoice(Args _args)
{
// Define a classvariable according to the
// type of posting being performed
SalesFormLetter_Invoice invoice;
SalesTable salesTable;
;
// Select the salesTable to update
salesTable = SalesTable::find(“SO-101297″);
// Create a new object of the SalesFormLetter_Invoice
// by using the construct-method in SalesFormLetter
invoice = SalesFormLetter::construct(DocumentStatus::Invoice);
// Post the invoice
invoice.update(salesTable,
SystemDateGet(),
SalesUpdate::All,
AccountOrder::None,
false,
true); // Set to true to print the invoice
}
The next screenshot shows the class hierarchy of FormLetter with all its sub classes:  we can easily customize the above logic to post different status updates against sales orders
and purchase orders
Sales (Confirmation, Picking list, Packing slip, Invoice )
Purch (Purchase order,Receipt list, Packing slip, Invoice)
Image

Monday, 14 July 2014

Version Control System in AX

A Version Control System (VCS) enables a team of developers to work, at the same time, on the code base in one or more projects. Using a VCS can have the following advantages, depending on which VCS you use:
  • Concurrent development
  • Isolated development
  • Change description
  • Change history
  • Change list support
  • Quality bar enforcement
MorphX, the Microsoft Dynamics AX Integrated Development Environment (IDE), can integrate various Version Control Systems (VCS). You can integrate:
  • Microsoft Visual Studio Team Foundation Server (TFS)
  • Microsoft Visual SourceSafe
  • MorphX VCS
  • Another third-party VCS
Version Control Considerations

If you use the VSS or TFS version control systems, you should consider the following before you develop code or write documentation:
  • Version control is file-based.
  • You must install Microsoft Visual Studio or Microsoft Visual Studio Team Explorer.
  • Each developer must have an Application Object Server (AOS) and database server.
MorphX VCS allows for out-of-the-box version control system integration. MorphX VCS is intended for one to ten developers who use a shared AOS. Instead of checking out objects and storing them in a repository, MorphX VCS signals to other users that a specific element is being worked on by another user. It provides change description functionality, change history functionality, and quality bar enforcement.


Microsoft Dynamics AX can integrate with VSS, TFS, and MorphX VCS, but you can extend the version control functionality to use other version control systems.

The following table compares the features available from the different version control options:
MorphX
MorphX VCS
Visual SourceSafe
TFS
Concurrent development
No
No
Yes
Yes
Isolated development
No
No
Yes
Yes
Change description
No
Yes
Yes
Yes
Change history
No
Yes
Yes
Yes
Quality bar enforcement
No
Yes
Yes
Yes
Branching
No
No
No
Yes
Work item integration
No
No
No
Yes
Labeling support
No
No
Yes
No

To add Elements to the version control system


  1. In the AOT, right-click the element and then click Add to Version Control.
  2. After you check in the element, it can be checked out of the version control system.

After you check in the element, it can be checked out of the version control system.
The element is added to the current model. The current model and layer are displayed in the status bar in Microsoft Dynamics AX and may also be displayed together with the element in the AOT.
You cannot have two models under version control in the same layer if elements occur in both models. You must develop outside of version control when this is the scenario. For example, during upgrade you might have fields that occur in the original table and the upgrade table.
If you add an element in a lower layer to version control and then customize the element in a higher layer, you may encounter problems when you synchronize. If you develop in multiple layers, we recommend that you create separate VCS branches for each layer.
If you cannot check in a new element, it might have failed some of the quality checks set in the system settings for the version control system. These settings are typically chosen by an administrator, and are set in the System settings form.

Checking Out and Checking in the Label File

Create or edit labels by using the Label editor. When you create a new label, a temporary label ID is assigned to it.

To add a label file to version control

  1. Click Tools > Label > Label editor.
  2. Click Add to version control.

To check out the label file

  1. Click Tools > Label > Label editor.
  2. Click Check out.
When finished, check the label file back in. When you check in a new label, the temporary label ID and references to it are mapped to a globally unique label ID.

To check in the label file

  1. On the Label editor form, click Check in.
  2. Type a description of the work you completed, and then click OK.




Resolving References to a Temporary Label ID that is Not Valid

If you have references to a temporary label ID that has already been checked in, those references are not valid because the temporary label ID is replaced with a globally unique label ID when you check it in. This can happen when references to the temporary label ID are not in the scope of the check-in.

To resolve references to temporary labels

  1. Manually locate references to a temporary label ID that should reference the new globally unique label ID.
  2. Update the references to point to the new globally unique label ID.

To check out an element from the AOT

  • In the AOT, right-click the element, and then click Check Out.
The Check Out command synchronizes the local copy with the version control system copy before checking it out. You can select multiple items in the AOT and check them out in one step.