To create and enable a custom Forms database, you should perform four steps:
- Open the FormsXX.nsf database with Lotus Notes or Designer and click the menu: File - Application (Database) - New Copy (You must give the database a new replica ID). Name the database whatever you please, for example: Forms8_customized.nsf.
- Add the new Forms database to the list of allowed iNotes Forms for your Domino server by modifying the following environment variable on your Domino server iNotes_WA_FormsFiles=iNotes/Forms7.nsf,iNotes/Forms8.nsf,iNotes/Forms8_customized.nsf
- Change the $FormsTemplateFile field on the icon note of any mail database so that the Domino server knows which Forms database to use (shown below)
- Change the $FormsTemplateFile field on the icon note of the new Forms database you created.
You can also enable a separate Extension Forms database by changing the $FormsTemplateExtFile field on the icon note of the Forms85.nsf database.
Did you know that the database icon note of all Notes Mail databases contains more data than just the icon? The easiest way to access the database icon note is via the special NoteID "FFFF0010".
Here are some of the fields you might find on the icon note of a Mail database:
|
|
|
|
|
"0" enable|disable Domino Attachment and Object Storage (R8.5)
|
|
|
A special string of flags that represent the database properties you see on the File - Application - Properties dialog box
|
|
|
"iNotes/Forms85.nsf" Where to find the Lotus iNotes UI
|
|
|
"1" This lets the Domino server know that the database uses a Lotus QuickPlace design
|
|
|
"en" The language of the design notes
|
|
|
|
|
|
"1" This lets the Domino server know that the database does not use the standard Domino Web design
|
|
|
|
In addition to the above fields, this field can be found on the icon note of a Forms85 database:
|
|
|
|
|
"iNotes/Forms85_x.nsf" Where to find the Lotus iNotes Extension Forms database
|
If you have made customizations to the Lotus iNotes Forms database (Forms8.nsf, Forms7.nsf, Forms6.nsf, etc), and you only want to show those customizations for certain folks, you could rename the Forms database to something unique and set that Forms database by changing the value stored in the icon note.
Here is an agent that you might run from any database. It displays a view of your corporate NAB (Names.nsf on your Domino server) and lets you select people that will receive the new iNotes UI.
(Runtime target in Agent properties = "None")
Option Public
Option Explicit
Sub Initialize
Dim ns As New NotesSession
Dim uiw As New NotesUIWorkspace
Dim nc As NotesDocumentCollection
Dim dbThis As NotesDatabase
Dim docLog As NotesDocument
Dim docPerson As NotesDocument
Dim choices$, nab$, sFFName$
Dim vTmp As Variant
Dim nCount&, nTotal&
On Error Goto Err_Agent
Set dbThis = ns.CurrentDatabase
Set docLog = dbThis.CreateDocument
Call docLog.ReplaceItemValue("Title", "Activity Log - " & Cstr(Now))
' Get a list of all available address books
Forall dbNAB In ns.AddressBooks
If (True=dbNAB.IsPublicAddressBook) Then
choices = choices & "," & dbNAB.Server & " - " & dbNAB.FilePath
End If
End Forall
vTmp = Split(Mid(choices,2), ",")
If (Ubound(vTmp) > Lbound(vTmp)) Then
Select one of the address books
vTmp = uiw.Prompt(4, "NAB Picker", "Choose the address book:", "", vTmp)
End If
nab = StringValue(vTmp)
If (0=Len(nab)) Then
Exit Sub
End If
Call LogStatus(docLog, "AddressBook chosen = " & nab)
' Select people to convert to new Forms database
vTmp = Split(nab, " - ")
Set nc = uiw.PickListCollection(
3, True, vTmp(0), vTmp(1),
"$PeopleGroupsFlat", "People Picker",
"Select people for iNotes Forms database conversion")
Let user type in a new Forms database value
vTmp = uiw.Prompt(3, "New iNotes Forms Database Value", "Convert " &_
Cstr(nc.Count) & " users to a new iNotes Forms database named:",
"iNotes/Forms8-orange-theme.nsf")
sFFName = StringValue(vTmp)
If (0=Len(sFFName)) Then
Exit Sub
End If
Call LogStatus(docLog, "New Forms database name = " & sFFName)
' Modify all selected mail databases
nTotal = 0
For nCount = nc.Count To 1 Step -1
Set docPerson = nc.GetNthDocument(nCount)
Call LogStatus( docLog, SetFormsDbName(
sFFName,
docPerson.GetItemValue("FullName")(0),
docPerson.GetItemValue("MailServer")(0),
docPerson.GetItemValue("MailFile")(0)) )
Next
Exit_Agent:
On Error Resume Next
Call docLog.Save(True, False, False)
Exit Sub
Err_Agent:
On Error Resume Next
Call LogStatus(docLog, Error$)
On Error Goto Err_Agent
Resume Next
End Sub
Function SetFormsDbName( sFFName$, sFN$, sDS$, sDF$ ) As String
Dim nnFN As New NotesName( sFN ) FullName
Dim nnDS As New NotesName( sDS ) ' ServerName
Dim db As NotesDatabase
Dim docIcon As NotesDocument
Dim status$
On Error Goto Err_SetFormsDbName
status = nnFN.Abbreviated & ": "
Open the user's database
Set db = New NotesDatabase( nnDS.Abbreviated, sDF )
If (False=db.IsOpen) Then
Call db.Open("","")
End If
' Get the icon note using a special HEX value
Set docIcon = db.GetDocumentByID("FFFF0010")
Replace the value
Call docIcon.ReplaceItemValue("$FormsTemplateFile", sFFName)
Call docIcon.Save(True, False, True)
Set docIcon = Nothing
status = status & "new Forms value was saved"
Exit_SetFormsDbName:
Set db = Nothing
SetFormsDbName = status
Exit Function
Err_SetFormsDbName:
status = status & Error$
Resume Exit_SetFormsDbName
End Function
Function StringValue( vTmp As Variant ) As String
Dim sRtn$
On Error Goto Err_StringValue
sRtn = ""
If (False=Isempty(vTmp)) Then
If (True=Isarray(vTmp)) Then
sRtn = Cstr(vTmp(0))
Else
sRtn = Cstr(vTmp)
End If
End If
Exit_StringValue:
StringValue = sRtn
Exit Function
Err_StringValue:
Resume Exit_StringValue
End Function
Sub LogStatus( doc As NotesDocument, status$ )
Dim vBody As Variant
Set vBody = doc.GetFirstItem("Body")
If (vBody Is Nothing) Then
Set vBody = doc.CreateRichTextItem("Body")
End If
vBody.AppendText(status)
vBody.AddNewLine(1)
End Sub
Here's an agent you can use to change the $FormsTemplateFile field on the icon note of a single mail file, mail template, or of a newly created Forms database.
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Set db = workspace.CurrentDatabase.Database
Dim sFFName As String
sFFName = workspace.Prompt (PROMPT_OKCANCELEDIT, _
"Forms file name", "Enter Forms file name", "iNotes/Forms85.nsf")
If Not sFFName = "" Then
Set docIcon = db.GetDocumentByID("FFFF0010")
Call docIcon.ReplaceItemValue("$FormsTemplateFile", sFFName)
Call docIcon.Save(True, False, True)
Messagebox "Updated Icon note to " + sFFName
End If
You can use a similar agent to change the $FormsTemplateExtFile field on the icon note of the standard or a customized Forms database.