Manage Learn to apply best practices and optimize your operations.

How To Use the "Choose Address" Dialog from Within LotusScript

It's not possible from within LotusScript to directly call the"Choose Address" dialog (or any other @Formula build dialog), however there is a kind of workaround which will be presented here. The workaround consists of three components:

Code:
1. A profile document used to store the selected values from the the "Choose Address" dialog. You only need a form with at least one field to create the profile.

2. An agent "ChooseAddressToSendTo" which performs the @formulas to create the dialog. The agent contains the following code:

@SetProfileField("Recipients";"Recipients"; "";@LowerCase(@V3UserName));
DEFAULT Recipients:[email protected]( [Name] ) ;
@SetProfileField("Recipients";"Recipients";
Recipients;@LowerCase(@V3UserName))

The agent is scheduled to run manually from the lists of agents and to run only once.

3. The script agent ("Test") which does the retrieval of the values stored in the profile doc and uses this data to perform the intended actions.

The agent is scheduled to run manually from the lists of agents and to run only once.

The agent contains a function to retrieve the data from the profile document:

Sub GetAddresses(v As Variant)
     Dim docProfile As NotesDocument
     Dim db As Notesdatabase
     Dim s As New Notessession
     Dim UName As Variant
     Dim macro As String
     Dim itm As NotesItem

     macro="@LowerCase(@V3UserName)"
     Uname=Evaluate(macro)

     Set db=s.CurrentDatabase
     Set docProfile=db.GetProfileDocument("Recipients", UName(0))
     Set itm=docProfile.GetFirstItem("Recipients")
     v=itm.Values
End Sub

Within the agent the function "GetAddresses" is called when needed:

     Dim s As New notessession
     Dim db As New NotesDatabase( "", "" )
     Dim Empf As Variant
     ' Dim item As notesitem 'HDT 14.12.00
     Dim profildoc As notesdocument
     ...
     'your code
     Set db = s.currentdatabase
     Call GetAddresses(empf) 'HDT 14.12.00
     If empf(0) = "" Then
     Messagebox "No recipient selected!"
     Else
     'your code there
     End If
     ....

4. Two simple actions (within an action button or an agent) to start the two agents above:
Run '(ChooseAddressToSendTo)' agent Run '(Test)' agent

Using this action (or agent) you will be presented with the "Choose Address" dialog. The chosen addresses will the be stored in the profile document, from which the "Test" agent retrieves them and performs its actions with this data.

Dig Deeper on Domino Resources - Part 7

SearchWindowsServer
Search400
  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

SearchDataCenter
SearchContentManagement
Close