APPLICATION DESIGN


Examples: actions
Simulate Notes menus for Web users

Web users donft have access to IBMR LotusR NotesR menu choices when they work in IBMR LotusR Domino(TM) databases. Therefore, you should create menu equivalents for them.

Create actions with @command formulas and make them available as buttons in the action bar. Keep in mind that Domino cannot translate commands based on a selected document in a view because there is no notion of a "selected" document on the Web. For actions such as "Create Response Document," you must add a form action to the Main Topic form for opening a Response document.

To Web-enable all buttons in a database as well as certain @commands, select the database property "Web access: Use JavaScript when generating pages." Without this property set, Domino recognizes only the first button in a document and treats it by default as a Submit button that closes and saves the document.

Be aware that Domino displays all buttons, actions, and hotspots -- even those that contain @commands and @functions that arenft supported for Web applications.

Complete these steps to create a button to open a new Main Topic in the current database:

1. Open the view where you want to add the button for Web users.

2. Choose Create - Action - Action.

3. Complete the Action Properties box. On the Action Info tab, do the following:

4. In the Info List, click Objects and click Create Main Topic.

5. In the Run pull-down list, select Client and then Formula.

6. Enter this formula:


7. Save the view.

Examples of other commonly used menu items:


Sending a document to reviewers

You want to simplify the process of distributing proposed concert schedules to a review board.

1. In the Concert Schedule form, create a field of type Names that will specify all the reviewers.

2. In the Concert Schedule form, choose Create - Action - Action and specify the following in the Action Properties box:

3. In the Info List, click Objects and select "Distribute for Review (Action)."

4. In the Run pull-down list, select Client and then "Simple action(s)."

5. Select the Add Action and Send Document actions.

6. Save the form.

Approving and denying requests

You want to improve a Requisition form to make it easy for managers to approve or deny requests that are mailed to them. You create two form actions: "Approve Request" and "Deny Request."

The "Approve Request" action uses this formula to change the documentfs status to Approved and routes the document to the next approver:

FIELD Status:="Approved";
@MailSend(NextApprover;"";"";"For your review";"Click Approve Request to approve this requisition or click Deny Request to return the request to " + Initiator;"Initiator":"Body";[sign]);

The "Deny Request" action changes the documentfs status to Denied and routes a notification to the initiator.

FIELD Status:="Denied";
@MailSend(Initiator;"";"";"Re: Your request";"Your request was unable to be approved. Contact " + PreviousApprover + "for more information.");

Displaying hidden text with a checkbox action

This example would allow a user to check a box requesting the display of additional explanatory text for a data entry form. You can use a checkbox action anywhere you would use a regular action. When you create a checkbox action, you need two pieces of code. One is a formula for the "Value" property of the checkbox action to specify under what conditions Notes should display the checkmark. The other, the "Click" formula or script, toggles the checkbox value and does whatever else you need the action to do. You must have a place, such as a field on a profile document, or an environment variable, to store the checkbox state.

A checkbox gvalueh formula, like a hide formula, must return a True/False value. If True, the checkmark is displayed. In this example, the value formula displays a checkmark if a multi-valued field personal profile named "Options" contains the value "Verbose".

@GetProfileField("UserProfile"; "Options"; @UserName) = "Verbose"
The example code for the gClickh event inserts the value "Verbose" into the profile document field if it's not already there, or removes it if it is there.

_opts := @GetProfileField("UserProfile"; "Options"; @UserName);

@If(_opts = "Verbose";

@SetProfileField("UserProfile"; "Options"; @Trim(@Replace(_opts; "Verbose"; "")); @UserName);

@SetProfileField("UserProfile"; "Options"; @Trim(_opts : "Verbose"); @UserName)

);

REM {Redisplay the current form in the new mode.};

@If(@IsDocBeingEdited; @Command([ViewRefreshFields]); "")

The code above the REM statement changes the value of the toggle. In this example, the Verbose option makes the application's forms display extra static text, to help novice users enter data. Hide formulas on the form test the profile document field to decide whether to display the text. If the user is editing a document, this action refreshes the screen to display the previously hidden help text (or vice versa). The hide formula might look like:

!(@GetProfileField("UserProfile"; "Options"; @UserName) = "Verbose")
Tips


SetDocField, or @DbLookup.
See Also