An action is a programmable button that can be used to automate tasks. Actions normally appear in the Action bar, which can be displayed in forms, subforms, pages, folders, and views. Additionally, actions may be displayed in the Actions menu in the Notes client. Actions can be shared, enabling you to use an action in multiple forms, pages, views, and so on. Actions are most often used in the following situations:
When you want to automate a function, but don't want the code stored with each individual design element.
When Web clients need substitutes for Notes client menu choices (through the Action bar).
When users need to see all the possible choices in a nonscrolling row at the top of a form or page or view. When buttons are placed in a form or page, they scroll with the form.
When the function the action performs isn't limited to a particular section of a form or page.
When you want to share an automated function between several design elements, making the maintenance of the application easier.
There are two basic types of actions: single use and shared. A single use action can be used only in the form, view, folder, or page where it is created. A shared action is stored as a database resource and can be used across multiple forms, subforms, views, folders and pages. Shared actions are covered in Chapter 9, “Design Elements.”
When you create an Action, you have several coding choices, depending upon which environment (Web or Notes client) the Action will be used. Additionally, you may elect to use one of the predefined System actions Lotus has included.
You can use any of the following choices to program actions that will be used in Notes client applications:
Simple actions
Formulas
JavaScript
Common JavaScript (shared library).
Common JavaScript is new to Domino 6 and can be used to write JavaScript code that can be used in certain limited events for both Notes client and Web applications. |
LotusScript
You can use JavaScript or Common Javascript (shared library) to program actions that will be used in Web client applications.
Domino provides a set of predefined actions, known as system actions, that automate some of the most basic and common Notes features. The system actions are included in the following list:
Categorize— Add values to the Categories field in the current document.
Move to Folder— Move the current document to a specified folder.
Remove from Folder— Remove the current document from a specified folder.
System actions that use system commands do not work on the Web. Instead, create custom actions to replicate their functionality. |
Follow these steps to create a single-use action that can only be used in the design element that hosts it:
1. | In the Notes Designer client, open the form or view. |
2. | Choose Create, Action, Action, which launches the Action properties box and displays the Info tab, shown in Figure 4.2. Figure 4.2. The Action properties box enables you to define how your action will display. |
3. | Enter a name for the action. |
4. | Optionally, enter a label. This is a new feature in Domino 6; it enables you to enter a formula that will compute a value to display for the Action's label. If a label is not supplied, the name will be used for the label. |
5. | If you plan to display the action within a specific frame, select the target frame. |
6. | Select the display parameters of the action, which are defined in the following list:
|
7. | If you are displaying the action as a button on the Action bar, you can select a graphic icon to display in the button. If you want to use an image resource, determine whether it is to be Notes, which uses the palette of available icons that come with Notes, or Custom, which enables you to select any image that you supply. |
8. | Optionally, Click the Action Hide When tab (it looks like a window shade) if you want to hide the action under certain conditions. |
9. | Select the appropriate choices, which are fairly self-explanatory. If the action should be hidden under certain conditions, check the Hide Action if Formula Is True check box and enter a formula that evaluates to true when the hide-when conditions are met. |
10. | Optionally, define Publishing settings for the action in the Advanced tab. |
11. | Close the Action properties box. |
12. | In the Objects tab of the Programmer's pane, select the action you just created. |
13. | Expand the Run pull-down list and select the environment in which the action will run: Client or Web. |
14. | Choose a coding choice appropriate for the selected environment and enter code. |
15. | Save the design element that contains the action. |
16. | Test the action to ensure that it works properly. |
To modify a single-use action, follow these steps:
1. | In the Notes Designer client, open the design element that contains the action. |
2. | Choose View, Action pane (which opens the Action pane), or select the border between the window in which the view or form is displayed and the Action pane and drag it to the desired position. |
3. | |
4. |
Problems with single-use Actions usually fall into one of two categories: actions that are either hidden or visible at inappropriate times, and programming problems.
Follow these steps when troubleshooting action hide-whens:
Follow these steps when troubleshooting action programming:
1. | |||||||||
2. | Choose View, Action pane (which opens the Action pane), or select the border between the window in which the view or form is displayed and the Action pane and drag it to the desired position. | ||||||||
3. | Click the action to display the action's contents in the Programmer's pane. | ||||||||
4. | Begin to debug the action. The type of action determines the most appropriate method of debugging. Table 4.2 lists the best way to debug a particular action based on its code. Table 4.2 contains some common action debugging methods.
| ||||||||
5. | Save the form or view. | ||||||||
6. | Test the action to make sure the expected results are displayed. | ||||||||
7. | Repeat steps 4–6 until the action works as expected. |
18.218.252.81