Contact Me

Total Pageviews

Sunday 10 August 2014

Lookup form To Display the values of Enumeration

We will use:

SysLookup::lookupEnum(SysDictField _sysDictField) in AX 2009. 

This method is used to display Enum Values on a Form control.

Override the lookup Method of the String Edit Form control and write :

public void lookup()
{
 this.performFormLookup(SysLookup::lookupEnum(new SysDictField(tableNum(SalesTable),  fieldNum(SalesTable, SalesType)))); //SalesType is a Enum Field of SalesTable.
}

That's it the form control will contain the SalesType enum Values now.

Note :

The Same method in Ax 2012 contains one more Parameter and the Syntax is :

client public static FormRun lookupEnum(SysDictField _sysDictField, [container _excludedEnumValues])

As you Can see using the Container you can filter Enum Values to be displayed in the Lookup on form control. 

To Filter enum Values on a form control in Ax 2009 refer to this post of my Blog.

Happy Daxing :)


No comments:

Post a Comment