To enable or disable an action pane button
- In the AOT, expand Forms and find the form for the list page where the action pane button appears. Use theInteractionClass property of the form to get the name of the interaction class for the list page.
- Expand Designs, expand Design, and then expand the Action Pane. Get the name of each action pane button that you want to enable or disable based on the list selection.
- Expand Classes, right-click the interaction class for the list page, click Override Method, and then clickselectionChanged. The Editor window opens and displays the selectionChanged method.
- Check that Control which you want to Enable or Disable has property AutoDeclaration is set to Yes.
public void selectionChanged()
{
TableName TableBuffer = this.listPage().activeRecord(queryDataSourceStr(QueryName, DataSourceName));
Super();
if(Condition) //like - if(TableBuffer.fieldName == Something)
this.listPage().actionPaneControlEnabled(formControlStr(FormName, ControlName),true);
Example:-
public void selectionChanged()
{
Requisition requisition = this.listPage().activeRecord(queryDataSourceStr(RequisitionQuery, Requisition_1));
super();
if(requisition.WorkflowApprovalStatus == WorkflowApprovalStatus::Approved)
this.listPage().actionPaneControlEnabled(formControlStr(RequisitionListPage,Edit),true);
else
this.listPage().actionPaneControlEnabled(formControlStr(RequisitionListPage,Edit),false);
}