20 August 2013

AX 2012 Table inheritance with example

Step-1 Create a table called 'BaseTable'
Step-2 Set table property 'supportInheritance' to 'Yes'
Step-3 Create a filed name called 'InstanceRelationType' extends 'RelationType'
Step-4 Set table property 'InstanceRelationType' to 'InstanceRelationType'
Step-5 Create two filed called Id and Name as shown below screen
Step-6 Create another table called 'ChildTable'
Step-7 Set table property 'supportInheritance' to 'Yes'
Step-8 Set table property 'Extends' to 'BaseTable'
Step-9 Write a job to access the base table fields given below

static void dataInsert_BaseTable(Args _args)
{
BaseTable bt;
ChildTable ct;

ct.Id = '1000';
ct.Name = 'Test';
ct.insert();
}

AX 2012 Model store database and baseline model store

Model store database
The model store is the database where all application elements for Microsoft Dynamics AX are stored. Customizations are also stored in the model store. The model store replaces the Application Object Data (AOD) files that were used in earlier versions of Microsoft Dynamics AX.

Baseline model store
The baseline model store holds model store tables for the earlier version of the metadata and is used only during upgrade. The baseline model store is like the old folder in earlier versions of Microsoft Dynamics AX.

Note : In Microsoft Dynamics AX 2012 R2, the model store was moved into a database that is separate from the business database.

16 August 2013

X++ Code Optimzation performance tuning

X++ Code Optimzation
Following are the coding tips to improve your Axapta system's performance:
1. Smart Joins : Try to Use Joins instead of nested while loop
wherever possible.
2. Select Statement : Mention the field names in the select statement
instead of feteching entire row , this will reduce
data amount to transfer from database.
e.g " Select Itemid from inventTable "

3. Display Methods : Make sure that generic display methods should be
moved at table level and cached by
using"Formdatasource.cacheAddmethod".
4. Local caching : Use Variables for storing the constantly used
caculated values in loop , by doing so you can
reduce the calls to the database and different
layers.
5. Monitor the Database Calls : For bulk records
updation,deletion,insertion use
RecordSet Based operator like
update_recordset , delete_from and insert_recordset .
6. Aggregate Function: Use sum, avg, minof, maxof and count where
applicable. Because this can utilize the database’s
built-in function instead of calculating and analyse
data in Axapta.

15 August 2013

AIF Custom service atributes in AX

SysEntryPointAttribute:This is a mandatory attribute in methods that
are exposed as a service operation. It indicates
that the method is a service operation. Not
using this attribute will result in a service
group deployment failure.
An optional parameter specifies whether the
AOSAutorization setting on the tables will
be checked when this method is executed on
the server.
Ex:
[SysEntryPointAttribute(true)]
private void GetRecord(Str _titleId)
{
}
DataContractAttribute:Defines that the attributed class is used as a
data contract for a service.
Ex:
[DataContractAttribute]
private void GetRecord(Str _titleId)
{
}
DataMemberAttribute:Indicates that a parameter method is a data
member in a data contract for a service.
Ex:
[DataMemberAttribute]
private void GetRecord(Str _titleId)
{
}

AifCollectionTypeAttribute:This attributes specifies the type that is used
in a collection. It contains the name of the
parameter that is targeted and the types of the
objects that are contained in the collection.
Ex:
[AifCollectionTypeAttribute]
private void GetRecord(Str _titleId)
{
}

08 August 2013

Get Customer name and Vendor name in display method in 2012

Hi Friends,

Str name;

//Customer name
name = DirPartyTable::getName(CustTable.Party);

// Vendor Name
name = DirPartyTable::getName(VendTable.Party);

above peace of code can use in display method.

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension-...