Hi Folks J
Today’s post will help you when you need to have customize filter on list page form in AX 2012:
As shown below:
Shown above is “smmActivitiesListPage” where we have 3 different filter fields:
- Activity number [String]
- Responsible [Reference group]
- Status [Customized Enum field, which consist of 3 element: All, Open, Closed]
Let’s observe how each of this helps in filtering smmActivities record on the list page.
Activity number field [string]
This is the normal string field added in the group filter of ListPage, and assigned the corresponding EDT [smmActivityId] to get appropriate lookup. As shown in field properties “FilterExpression” is the one which we input in the filter box, “FilterDatasource” provides the datasource under form which need to be filtered and “FilterField” is the one which need to be filtered in the datasource field.
Responsible worker: As we do not have direct string field to select the employee name, so using the smmActivityWorker EDT under reference group to display all the employee name under lookup.
ActivityStatus [Customized new enum field]:
Since this is new fields which is a type of enum and consist of 3 elements: All, Open, Closed
- All – It has to display all the records in smmActivitiesListPage form.
- Open – Filter the records where activity status are open i.e. 0 value.
- Closed - Filter the records where activity status are closed i.e. 1 value.
As shown below in the FilterExpression new method [getActivityStatus (%1 = status)] name was written along with the parameter which accepts the ActivityStatus.
New method need to be created in the SysQueryRangeUtil class with the required parameter [status in my case] as shown below:
Note: if you are passing the string value in the parameter %1 can be written as “%1”.