Hide Button ListPage form


As we already know we cant override any methods in list page form, here is the scenario where i need to hide few button based on the status of the workflow for data security.

In order to write any logic for the “List page” from we need extend the “InteractionClass” to perform this operation.

class Mzk_Interaction extends ListPageInteraction


public void initializeQuery(Query _query)

// this method will be executed while opening the “List page” form.

//like init() method for standard froms


public void selectionChanged()

//this method will execute when any operation is perform on the list page form level

//like active() method for the other forms.


1. get data while opening the from. write logic in “initializeQuery”

if ((this.listPage().listPageArgs().menuItemName() ==
menuitemDisplayStr(Mzk_AlternativeLeave))) // 1. Alternative Leave

qbds = _query.dataSourceTable(tableNum(Mzk_AlternativeLeave));
categoryRange = SysQuery::findOrCreateRange(qbds, fieldNum(Mzk_AlternativeLeave, Worker));

// Required by questionnaire form
qbds.addSelectionField(fieldNum(Mzk_AlternativeLeave, Worker));
if (hcmworkername)
select * from HcmPositionWorkerAssignment
where HcmPositionWorkerAssignment.Worker == hcmworkername;

while select HcmPositionHierarchy
where HcmPositionHierarchy.ParentPosition == HcmPositionWorkerAssignment.Position
select * from HcmPositionWorkerAssignmentempl
where HcmPositionWorkerAssignmentempl.Position == HcmPositionHierarchy.Position;

select * from HcmWorkerreportingempl
where HcmWorkerreportingempl.RecId == HcmPositionWorkerAssignmentempl.Worker;

hcmworkername = HcmWorkerreportingempl.RecId;

_query.dataSourceNo(1).addRange(fieldNum(Mzk_AlternativeLeave, Worker)).value(queryValue(hcmworkername));
//Will allow employee to apply in his company only
this.listPage().actionPaneControlEnabled(formControlStr(Mzk_AlternativeLeave,NewButton), hcmWorkerCompany.NewCompanyName == curext());

2. Hide the button/filed based on the selection change. write code in selectionChanged()

public void selectionChanged()

if ((this.listPage().listPageArgs().menuItemName() ==
menuitemDisplayStr(Mzk_LeaveHistoryListPage))) //1.Leave history
//Mzk_LeaveHistory = this.listPage().activeRecord(queryDataSourceStr(Mzk_LeaveHistoryQuery,Mzk_LeaveHistory_1)); // it will picked it from Ax
Mzk_LeaveHistory = Mzk_LeaveHistory::findRecId(this.listPage().activeRecord(queryDataSourceStr(Mzk_LeaveHistoryQuery,Mzk_LeaveHistory_1)).RecId); // it will pick from both ax and ep
this.listPage().actionPaneControlEnabled(formControlStr(Mzk_LeaveHistoryListPage,DeleteCommandButton), Mzk_LeaveHistory.LeaveStatus == LeaveStatus::Created);
this.listPage().actionPaneControlEnabled(formControlStr(Mzk_LeaveHistoryListPage,EditButton), Mzk_LeaveHistory.LeaveStatus == LeaveStatus::Created);



One thought on “Hide Button ListPage form

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s