Friday, September 14, 2007

Compare Tool

Do you know that you can compare an AOT object with the object in:

- Standard layer version types
- Old laye version types
- Version Control revisions
- Best Practices washed version
- Export / Import file
- Upgraded version


U can find a very helpful article at following address:
http://insidedynamicsax.blogspot.com/2007/09/compare-tool.html

Friday, September 7, 2007

BaseEnum Field Mandatory

If you set mandatory to a BaseEnum field in a table then the Element having Value = 0 of this BaseEnum would not be accessible.

This is because generally Zeroth Index is basically used for 'None' in AX. Now to make sure that user does not select 'None' as an option in the field, this is the default behavior of AX.

So the suggestion is that you should not use Zeroth index for any Element of a BaseEnum except 'None'. If you don't have any 'None' element in your BaseEnum then start the elements from 1, otherwise, if you would set it mandatory then user may not set it.

Muhammad Shujaat Siddiqi

Cloning Table Buffers in Dynamics AX

I was wondering how would i clone a table method in my code as there is no clone method on Table buffer. There is also no property on a table which set it CLONEABLE.

There I find another way of doing this. i.e. I can copy all the contents of one Table buffer to other using data method of Table buffers.

This is like:

Table1 table11;
Table1 table22;

table11.data(table22.data());

This would copy all the conents of table22 to table11. Otherwise setting it like this:
table11 = table22;
would set both the reference to same object which may not be required.

Shujaat.

Thursday, September 6, 2007

Configuration Key checking through code

Sometimes there is a requirement to check the availibility of configuration key in code to make some functionality available to user.

AX provides this facility in code in Global. The method is isConfigurationKeyEnabled(). This method takes ConfigId as argument and returns boolean.

isConfigurationkeyEnabled(configurationKeyNum(AIF))

Enjoy this...........

Muhammad Shujaat Siddiqi

Unit Testing Table methods in AX

There are few additional requirements to unit test table methods.

Override following methods:

1- testElementName
public identifiername testsElementName()
{
identifiername ret;
ret = super();
return "Table1";
}

2- testElementType()
public UtilElementType testsElementType()
{
return UtilElementType::Table;
}

If you don't override these methods then there would be ZERO code coverage of your methods.

Don't forget to inherit your Unit Test class from SysTestCase.
Also take care of the naming requirement of your Unit Test Class.
The name of method must also be in accordance with the naming requirement of methods.

Thanks.

Shujaat.