How do I get a profile document with script. @GetProfileField in script: LotusScript GetProfileField. Lookup to profile field in Lotus Script.
How do I get a profile document with script. @GetProfileField in script: LotusScript GetProfileField. Lookup to profile field in Lotus Script.
| Answer | Often you may want to lookup a field in a profile document while using LotusScript.
The help database gives this detail on the NotesDatabase method.
Set notesDocument = notesDatabase.GetProfileDocument( profilename$ [, uniqueKey$ ] )
Parameters.....
profilename$: String. The name or an alias of the Profile document.
uniqueKey$: String. Optional. The unique key associated with the Profile document.
Return value: notesDocument
The unique key is used to determine which profile you are loading.
You see there can be more than one profile document using the same profile form i.e individual user profiles can be set using the unique key. In the sample below we use "DBProfile","DBProfile" as this means the global database profile (singular). the form name could be called anything you wish.
An example use of this is below:
Dim session as new NotesSession
Dim thisDB as NotesDatabase
set thisDB = session.CurrentDatabase
Dim profileDoc as NotesDocument
Set profileDoc = thisDB.GetProfileDocument("DBProfile", "DBProfile")
...We can now get fields using standard notation i.e
profileDoc.fieldname(0) etc
'DBprofile is the name of the form that is used to create the profile, this is also the profiles name as we only have one global profile often is configurable DB's.
'Some more sample code
Set doc = db.GetProfileDocument("Interest Profile",session.UserName)
The code above could be used to get profiles that have been saved for each user. |
| Attachments | -none- |
| Applies to versions | 4.x; 5.x; 6.x |
| FAQ Provided By | Steve C Robinson |
| Credit | |
 |  |
|
|