Search This Blog

Thursday, April 25, 2013

Args class in Axapta


 

The Args system class is one of the most widely used classes in Axapta.
 Args is an abbreviation for arguments and an Args object is used to
pass information from one object (caller) to another newly created object.

Using Args for object creation
Args    args = new Args("CustTable");
FormRun formRun = ClassFactory.formRunClass(args);
;
formRun.init();
formRun.run();
formRun.wait();

caller:

public Object caller( [Object _value] )

This method gets or sets the calling object.
 When creating an args object directly through code,
 the caller will not be automatically set, so you should set it yourself.

Record:

public Common record( [Common _value] )

this method gets or sets a table buffer (record) attached to the Args.
 A buffer of any table can be attached to an Args object using this method. 
Be aware when retrieving the buffer that there will be no compile-time check of table id. 
You should use the dataset method below to check the contents of the buffer.
If the caller and callee are on different tiers, 
then the applications will automatically copy the buffer to the target tier.

Dataset:

public tableId dataset()

this method gets the table Id of a table buffer (record) attached to the Args.
To safely retrieve an attached record from an Args object,
use code similar to that shown below.
This checks to ensure that there is an attached record,
and that it is in fact a SalesTable record, before trying to assign it to the salesTable variable.

if (args.record() && args.dataset() == tableNum(SalesTable))
salesTable = args.record();

parm:

public str parm( [str _value] )
parm is used to pass a string variable to the called object

parmEnum:

public anytype parmEnum( [int _value] )
see parmEnumType

parmEnumType:

public int parmEnumType( [int _value] )
parmEnum and parmEnumType are used together to pass a Base Enum value through to the called object. An example is shown below.
args.parmEnumType(EnumNum(AddressType));
args.parmEnum(AddressType::Delivery);

parmObject:

public Object parmObject( [Object _value] )
parmObject is used to pass a reference to any object to the called object.
Be aware of client-server issues if the caller and callee are on different tiers.

menuItemName:

public final str menuItemName( [str _value] )

menuItemType:

public final MenuItemType menuItemType( [MenuItemType _value] )
A short tutorial on how to open a form in Dynamics Ax (Axapta) by code.

Just take a line of code:

new MenuFunction(MenuItemDisplayStr(CustTable),MenuItemType::Display).run();

The above code will open the CustTable form. That's all it takes.
Now if you want to supply some arguments to the opening form,
 this is also possible with the optional args parameter.

static void FormOpen()
{
Args args = new Args();
;
args.record(CustTable::find('CUS-001'));
new MenuFunction(MenuItemDisplayStr(CustTable),MenuItemType::Display).run(Args);
}

This code will open the CustTable form and filter out the
customer with accountnumber CUS-001.

Enjoy Daxing..

Date functions in AX 2009


Date functions in AX 2009


Date functions in AX 2009

These are some of the functions,from where we can get the day or month
 or year from the date...
Here is the below example....

static void date_Functions(Args _args)
{
Transdate    d;
;

d = today();

info(strfmt("Date - %1",d));

//Gets the month for the given date...
info(strfmt("Month - %1",mthofYr(d)));

//Gets the month name from the given date...
info(strfmt("Month Name - %1",mthname(mthofYr(d))));

//Gets the day for the given date...
info(strfmt("Day - %1",dayOfMth(d)));

//Gets the day name from the given date...
info(strfmt("Day Name - %1",dayname(dayOfMth(d))));

//Gets the year for the given date...
info(strfmt("Year - %1",year(d)));

//Gets the current weekday number from the date...
info(strfmt("Weekday number - %1",dayOfwk(d)));

//Gets the day of the year from the given date...
info(strfmt("Day of year - %1",dayOfyr(d)));

//Gets the week of the year from the given date...
info(strfmt("Week of the year - %1",wkofyr(d)));
}

Enjoy Daxing...

Tuesday, April 23, 2013

How to Aviod the null values from Lookup() in AX2009


 Avoid Null values in Lookup (AX2009)

If you don't want to show Null Values in a lookup list
The below code avoid Null Values in Lookup.
Ex: Avoid Null values from lookup i.e If Qty is zero avoid those record in the lookup
public void lookup()
{
 Query query          = new Query();
 QueryBuildDataSource    queryBuildDataSource;
 QueryBuildRange                    queryBuildRange,queryBuildRange1;
// Create an instance of SysTableLookup where 'this'
// is the current form control.
SysTableLookup sysTableLookup = SysTableLookup
           ::newParameters(tableNum(ItemControl),this);

;
// Add fields to be shown in the lookup form.
        sysTableLookup.addLookupField(fieldNum(ItemControl, BatchNumber));
        sysTableLookup.addLookupField(fieldNum(ItemControl, ItemId));
        sysTableLookup.addLookupField(fieldNum(ItemControl, onhand));

// Limit and arrange the data selection.

queryBuildDataSource = query.addDataSource(tableNum(ItemControl));

queryBuildRange = queryBuildDataSource.addRange(
        fieldNum(ItemControl, ItemiD));

        queryBuildDataSource.addRange(fieldnum(ItemControl,ItemID)).value(ProdBOM.ItemId);

queryBuildRange = queryBuildDataSource.addRange(
        fieldNum(ItemControl, onHand));

 // To Avoid Null Values from ItemControl Table in  //lookup        

queryBuildDataSource.addRange(fieldnum(ItemControl,
Onhand)).value(SysQuery::valueNotEmptyString());
        queryBuildDataSource.addRange(fieldnum(ItemControl,
Onhand)).value('!=0.00');


sysTableLookup.parmQuery(query);


// Perform the lookup.
if(ProdBOM.ProdLineType == BOMType::Production)
{
            sysTableLookup.performFormLookup();
}
else
{
            super();

}

}

Any uncertainty regarding lookup email me i will help you folks..

Happy Daxing...

Monday, April 15, 2013

How to change the Domain name on server in Dynamics Ax




First of all, after change the domain name, you need to change three things because the Dynamics AX works correctly:

If SQL Server is installed on the server

1)  MS SQL Server logon service

            If  you change the domain name you need to change

2)  Dynamics Server$Instance Name logon service

3)  Server Database of Dynamics AX Server Configuration Utility

After that and restarting the services, you should be able to start the Dynamics AX.

If you cannot start it, you need to review some database things explained Below..

In case you change the domain on the AX server computer, you will not be able to start AX because you don’t have appropriate privileges.
In order to resolve this you need to find USERINFO table in the database and change the record with ID = ‘Admin’
You should update following columns: 

     1)SID – you should enter your Windows SID (this is enough but you can also change another two fields) 
     2)NETWORKDOMAIN – your domain name

      3)NETWORKALIAS – network alias (username)
After this you will be able to start AX as admin and to admin other users.


Happy Daxing..

Tuesday, April 9, 2013

Overviews of AXAPTA build numbers


Overviews of AX build numbers




Dynamics AX 2012 R2
Version
Kernel build
Application build
Comment
Link
Dynamics AX 2012 R2 CU1
6.2.1000.156
 6.2.1000.156
 25 Feb 2013
Dynamics AX 2012 R2 (6.2) Hotfix
6.2.1000.xxx
6.2.1000.xxx

Dynamics AX 2012 R2 RTM
6.2.158.0
6.2.158.0


Dynamics AX 2012
Feature Pack
Kernel build
Application build
Solution build
Comment/Link
Dynamics AX 2012 FP1 (6.1) Hotfix
6.0.1108.xxx
6.0.1108.xxx
6.1.1108.xxx
Dynamics AX 2012 FP1 (6.1) RTM
6.0.947.862
6.0.947.280
6.0.1108.0
Version
Kernel build
Application build
Comment
Link
Dynamics AX 2012 CU5
TBD
 TBD

Cumulative Update 5 
Dynamics AX 2012 CU4
6.0.1108.2423
6.0.1108.2423

Dynamics AX 2012 CU3
6.0.1108.670
6.0.1108.670

Dynamics AX 2012 CU2
6.0.947.280
6.0.947.280

Dynamics AX 2012 CU1
6.0.947.61
6.0.947.61

Dynamics AX 2012 RTM Hotfix [new]
6.0.1108.xxx
6.0.1108.xxx
As of Feb 15th
Dynamics AX 2012 RTM Hotfix [old]
6.0.947.xxx
6.0.947.xxx
Until Feb 15th
Dynamics AX 2012 RTM
6.0.947.0
6.0.947.0


Dynamics AX 2009
Version
Kernel build
Application build
Link
Comment
Dynamics AX 2009 SP1 RU-8

Dynamics AX 2009 SP1 RU-7

Dynamics AX 2009 SP1 RU-6

Dynamics AX 2009 SP1 RU-5

Dynamics AX 2009 SP1 RU-4

Dynamics AX 2009 SP1 RU-3

Dynamics AX 2009 SP1 RU-2
5.0.1500.809
5.0.1500.809

Dynamics AX 2009 SP1 RU-1
5.0.1500.358
5.0.1500.358

Dynamics AX 2009 SP1 Hotfix [New]
5.0.1600.xxx
5.0.1600.xxx
As of April 18th
Dynamics AX 2009 SP1 Hotfix [Old]
5.0.1500.xxx
5.0.1500.xxx
Until April 18th
Dynamics AX 2009 SP1
5.0.1000.52
5.0.1000.52

Dynamics AX 2009 RTM RU-6
5.0.593.1429
5.0.593.1429

Dynamics AX 2009 RTM RU-5
5.0.593.1287
5.0.593.1287

Dynamics AX 2009 RTM RU-4
5.0.593.1084
5.0.593.1084

Dynamics AX 2009 RTM RU-3
5.0.593.827
5.0.593.827

Dynamics AX 2009 RTM RU-2
5.0.593.662
5.0.593.662

Dynamics AX 2009 RTM RU-1
5.0.593.439
5.0.593.439

Dynamics AX 2009 RTM Hotfix
5.0.593.xxx
5.0.593.xxx

Dynamics AX 2009 RTM
5.0.593.0
5.0.593.0


Dynamics AX 4.0
Version
Kernel build
Application build
Link
Comment
Latest SP2 Kernel Build
4.0.2503.1610


Published AX 4.0 Hotfixes




Monday, April 8, 2013

How to Create New financial dimension in AX2009



Hi friends many of the client  requirement’s  to create a new financial dimension in AX apart from the three standard dimensions "Department", "Cost center" and "Purpose".
Here is a steps to creating a new financial dimension.


To create a new financial dimension modify following objects one by one

1)Base enum "SysDimension" : Find this base enum and right click on this base enum -> Select option "New element". In properties window give a name to this element say "TestDim" and label as "Test dimension". Save the base enum.
2)Extended data type "Dimension" : Find this EDT and then add a new array element in this EDT. Name this array element as "TestDim". In properties window specify label as "Test dimension". Now in the "Relations" tab of this new array element add a new "Normal"  relation first. To this normal relation open properties window and set property Table as "Dimensions" and Related field as "Num". Now add another relation of type "Related field fixed". To this related field fixed relation open properties window and set Related field as "DimensionCode" and property value as "3" (this is the value of the new enum element created in SysDimension). Save the EDT.
3)Extended data type "DimensionCriteria" : Repeat the process of modification as done for EDT "Dimension" above.
4)Extended data type "XMLMapDimension" : Find this EDT in AOT and then create a new array element for this EDT. Label this array element as "Test document value". Save the EDT.
5)Extended data type "MandatoryDimension" : Find this EDT in AOT and then create a new array element for this EDT. Label this array element as "Validate test dimension". Save the EDT.
6)Extended data type "DimensionLedgerJournal" : Find this EDT in AOT and then create a new array element for this EDT. Label this array element as "Test dimension". Save the EDT.
7)Extended data type "DimensionKeepFromTransaction" : Find this EDT in AOT and then create a new array element for this EDT. Label this array element as "Keep transaction test dimension". Save the EDT.
8)Extended data type "COSAllowDimensions" : Find this EDT in AOT and then create a new array element for this EDT. Label this array element as "Test dimension". Save the EDT.
9)Extended data type "DimensionPriority" : Find this EDT in AOT and then create a new array element for this EDT. Label this array element as "Test dimension". Save the EDT.
10)Extended data type "DimensionAllocation" : Find this EDT in AOT and then create a new array element for this EDT. Label this array element as "Test dimension". Save the EDT.
11)Table "LedgerJournalTrans" : Find this table in AOT and add a new relation in the relations tab as follows. Create a new relation in relations tab and name it as say "interCoDimension3" (You can see three more similar relations with suffix 0, 1 and 2 for three standard dimensions). Now set the property table of this relations as "Dimensions". Create a new "Normal" relation under this realtion tab and set the property "Field" = "OffsetCompany" and property "RelatedField" = "dataAreaId". Create another "Normal" relation under this relation tab and set the property "Field" = "InterCoDimension[4]" and property "RelatedField" = "Num". Now create a new "Related field fixed" relation under this tab and set property "Value" = 3 (this is the value of the new enum element created in SysDimension) and property "Related field" = "DimensionCode". Save the changes.

The new financial dimension is successfully created in AX and can be viewed in different forms through out the AX where ever dimensions are used. After that first do compilation and then Synchronization then it will effect.

Please Don’t try it in Production directly …Try it in Test


Modules changes in MS Dynamics AX 2009 Vs. AX 2012


Modules changes in MS Dynamics AX 2009 Vs. AX 2012


AX 2009 Module
AX 2012 Module
General Ledger

Fixed Assets 
Bank
Cash and bank management
Accounts Payable

Procurement and sourcing 
Accounts Receivables
Accounts Receivables

Sales and Marketing 
Inventory Management
Product information 

Inventory  and warehouse management
Travel and expense management
Production
Production control
Project
Project management and accounting

Compliance and internal control 

Basic                                       Organizational Administration
Administration                     System Administration