SysOperationFramework : Field display order

Since the arrival of Dynamics Ax 2012, the traditional RunBaseBatch framework is getting obsolete. This has been replaced by the SysOperationFramework. This framework brings a few nice features that were missing in the RunBaseBatch framework. One them is the MVC pattern to separate concerns.

The basics

I would like to start with a few links concerning how to create SysOperationFramework services. A colleague of mine, Klaas Deforce, has created some posts that clearly explain how it works.

All of the post are linked through this overview post : http://www.artofcreation.be/2011/08/21/ax2012-sysoperation-introduction/

Field display order

Well now, let’s come to the question of this post : How can you determine the sequence of dialog fields on the dialogs created by the SysOperationFramework? The answer here lies in the Attributes available also in Dynamics Ax 2012. You have a contract with several datamembers marked with the [DataMemberAttribute] attribute. To determine the sequence you can add the [SysOperationDisplayOrderAttribute] attribute (http://msdn.microsoft.com/en-us/library/gg963068.aspx).

For an example of this, you can check the AssetBalanceReportColumnsContract class, method parmAssetBookId.

[
    DataMemberAttribute('AssetBookId'),
    SysOperationGroupMemberAttribute('Book'),
    SysOperationDisplayOrderAttribute('1')
]
public AssetBookMergeId parmAssetBookId(AssetBookMergeId _assetBookId = assetBookId)
{
    assetBookId = _assetBookId;
    return assetBookId;
}

Groups and group sequence

In the previous sample of code you can also see the SysOperationGroupMemberAttribute attribute. This is to determine which fields belong to a certain group on a dialog. And you can also use a custom sequence on groups by using the SysOperationGroupAttribute attribute as seen in the classDeclaration:

[
    DataContractAttribute,
    SysOperationGroupAttribute('Book', "@SYS95794", '1'),
    SysOperationGroupAttribute('Period', "@SYS40", '2')
]
public class AssetBalanceReportColumnsContract implements SysOperationValidatable
{
    boolean visibleFR;
    AssetBookMergeId assetBookId;
    ToDate closingDatePriorYear;
    ToDate closingDateThisYear;
}

So there you have it. If you want to rearrange things on the dialog, you can use the above method.

 

Leave a Comment Yourself

Your email address will not be published. Required fields are marked *