COMPOSITE APPLICATIONS - DESIGN AND MANAGEMENT


Defining Notes actions that consume properties
In this task, you will add an action to a IBM® Lotus® Notes® form. This action consumes the property published by another component in your composite application that you assemble and wire in a later task.

See the topic "Building Notes components" for more information about the new LotusScript classes, methods and properties.

Use the following procedures to accomplish this task:


Complete the following steps to add the action to your Notes form.

1. If IBM® Lotus® Domino(TM) Designer 8 is not already running, start it now and open MyDiscussion.nsf.


2. If needed, switch to the Forms list by clicking Forms in the designer pane on the left.

3. Click the DocByCategoryForm form and press Enter to open it in design mode.


4. Click Create > Action > Action... to add a new action to this form. The Action pane opens in the right top and the Properties box appears for the new action.

5. On the first tab of the Properties box, type "TutorialAction1" in the Name field.

6. On the last tab of the Properties box, click TutorialAction1 in the Composite Settings Action Name field list at the bottom.

7. Close the Properties box.

8. Click the newly created action TutorialAction1 in the action pane on the top right.

9. In the programmers pane at the bottom right, pick the Client and LotusScript options for the Run settings.

10. Input the following LotusScript code in the Click subroutine.


Sub Click(Source As Button)

Dim s As New Notessession

Dim db As NotesDatabase

Set db = s.currentdatabase

'handle to the database where this form is located.

Dim ws As New NotesUIWorkspace

Dim uidb As NotesUIDatabase

Dim uidoc As NotesUIDocument
'handle error 4719, returned when the script is run without a property broker context

On Error 4719 Goto err4719
'new property broker code

Dim pb As NotesPropertyBroker

Set pb = s.getPropertyBroker()
'create ’new NotesPropertyBroker object

Dim pbInputProperty As NotesProperty

Dim pbcontext As Variant

pbContext = pb.InputPropertyContext 'array of NotesProperty objects

Set pbInputProperty = pbContext(0) 'handle to first ’NotesProperty object

Dim InputPropertyName As String

Dim Namespace As String

InputPropertyName = pbInputProperty.Name

'name of the ’NotesProperty object

NameSpace = pbInputProperty.NameSpace
'namespace of the
'NotesProperty object

Print "InputPropertyName = " & InputPropertyName ’&" NameSpace = " & NameSpace

Dim pbvalue As Variant

pbValue = pb.GetPropertyValue(InputPropertyName) 'array of values of NotesProperty

cName$ = pbValue(0) 'first value from array of values of NotesProperty object

SkipPropertyBroker:

If cName$ = "" Then

cName$ = Inputbox("Filter", cName$)

If cname$ = "" Then

Exit Sub

End If

End If

' Messagebox cName$

Set UIdoc = ws.CurrentDocument

Call uidoc.FieldSetText("CategorytoDisplay",cName$)

Call uidoc.Refresh

Exit Sub

err4719:

Print "Error" & Str(Err) & ": " &Error$

Messagebox "error"

Resume skipPropertyBroker

End Sub

When you are finished, click File > Save to save your form changes. Finally, click File > Close to exit design mode.

You added an action to the Notes form. When you later use this Notes form as a component in a composite application, the component can consume a published property and perform the action defined by the LotusScript code.

See Also