Adding a script action to a widget toolbar or menu
You can add a script action to run a custom script from a widget toolbar or menu. For
example, you can add a script action to the Case Information widget toolbar
that enables users to add the selected case documents as attachments to a case.
About this task
To add a script action to a widget toolbar or menu:
Procedure
- In Case Builder, open the page that contains the widget in Page Designer.
- Click the Edit Settings icon for the widget that you want to add the script action to.
- Click the Menus or Toolbars tab and, if necessary, select the specific menu or toolbar that you want to add the script action to.
- Click the Add Menu Item icon or the Add Button icon.
- From the Action list, select Script Action.
- If you are adding a script action to a toolbar, select a position from the Alignment list.
- For Label, enter the display name for the script action.
- For Execute, enter the script to run when this script action is selected from the toolbar or menu.
- Optional: For Show this script action, enter a script that is run to determine whether the button or menu item for this script action is visible. If you do not enter a script, the button or menu item is always visible.
- Optional: For Enable this script action, enter a script that is run to determine whether the button or menu item for this script action is enabled. If you do not enter a script, the button or menu item is always enabled.
- Click OK.
- Save and redeploy your solution.
Example
The following example script action is intended to run in the context of the action implementation. For more information, see Class icm.action.Action.
var selectedDocuments = this.getActionContext("Document");
if (dojo.isArray(selectedDocuments))
{
var i;
for (i=0; i<selectedDocuments.length; i++)
{
// attach selected document: selectedDocuments[i]
...
}
}
else
{
// attach selected document: selectedDocuments
...
}
This topic is shared by BAW, CP4BA. Last updated on 2025-03-13 12:15