Add custom toolbar buttons
You can create a custom button that is added to the toolbar of a Web Client module or of the Manual Runner window, and control what the button does by adding script to the ActionCanExecute event.
To add a custom button to a toolbar:
-
From the Web Client banner, select Settings
> Workflow.
-
Go to the Toolbar Button Editor tab. From the Module list, select the module where you want to add a button.
-
Click Add. The button is given a default name.
-
Click the edit icon
to define the following properties of the button.
Property Description Caption Specify the button label. Hint Provide the mouse-over tooltip for the button. Action Name Enter the action name for the button, which indicates what action is to be performed when users click the button. Action Name in Workflow Read only and is automatically filled based on the action name, in the format of UserDefinedActions.<action name>.
If you want to call the action in the project scripts, call UserDefinedActions.<action name>.
Image Select an icon for the button. -
Click Save to add the button.
-
Add script to the ActionCanExecute event to define what the button does when users click it.
-
Go to the Script Editor tab.
-
From the Workflow Scripts tree, select Project Scripts > Common script > ActionCanExecute.
-
In the scripts pane, add JavaScript code to define what to be performed when a user initiates an action by the button's action name.
For example, the following code opens a message box when the user clicks the Requirements_msg button on the tool bar of the Requirements module:
Copy codefunction ActionCanExecute(actionName) {
if (actionName === 'UserDefinedActions.Requirement_msg') {
MsgBox('This requirement cannot be deleted.');
return false;
}
return true;
} -
Click Save.
-