COMPOSITE APPLICATIONS - DESIGN AND MANAGEMENT
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:
1. If IBM® Lotus® Domino(TM) Designer 8 is not already running, start it now and open MyDiscussion.nsf.
3. Click the DocByCategoryForm form and press Enter to open it in design mode.
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.
Note Bold comment text is used to describe various code lines.
Tip You can copy and paste the following. If needed, after pasting the code, remove any duplicate Sub and End Sub statements. Bold text is comment annotation.
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
' Messagebox cName$
Set UIdoc = ws.CurrentDocument
Call uidoc.FieldSetText("CategorytoDisplay",cName$)
Call uidoc.Refresh
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