Search



Lotus iNotes: How to enable a custom Forms database

Skip to article content
Article information
  • Edit
  • Lotus iNotes customization
    Lotus iNotes , customization
    Daniel Gurney
    01/06/2009
    Daniel Gurney
    02/04/2009
      Written by IBM


    To create and enable a custom Forms database, you should perform three steps:
    1.        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.
    2.        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
    3.        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)



    Did you know that the database icon note of all Notes 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:
    Field name Description
    $Daos "0"  // enable|disable Domino Attachment and Object Storage (R8.5)
    $Flags // A special string of flags that represent the database properties you see on the File - Application - Properties dialog box
    $FormsTemplateFile "iNotes/Forms85.nsf"  // Where to find the Lotus iNotes UI
    $HaikuFlags "1"  // This lets the Domino server know that the database uses a Lotus QuickPlace design
    $LANGUAGE "en"  // The language of the design notes
    $TITLE // The database title
    $WebHybridDb  "1"  // This lets the Domino server know that the database does not use the standard Domino Web design
    IconBitmap // The database icon


    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

    Comments

    1) How is the $FormsTemplateExtFile used?
    Steve Sherwood | 6/4/2009 9:43:29 PM ET

    Re. { Link } how is the $FormsTemplateExtFile value used? I don't understand what is meant by "This is a database that can be modified with touching the original Forms85.nsf".

    Thanks.

    2) Lotus iNotes: How to enable a custom Forms database
    Eric Spencer | 6/5/2009 11:57:44 AM ET

    It seems like you are looking at an earlier revision of the article. That $FormsTemplateExtFile item does not appear in the latest version of the article. The item does not apply to 8.5 and earlier releases.