Q
Problem solve Get help with specific problems with your technologies, process and projects.

Using LotusScript to retrieve names of fields on a Lotus Notes form

Learn what steps to take -- and some code to go along with it -- to retrieve names on a Lotus Notes form using LotusScript.

Is it possible to retrieve the names of fields from a particular Lotus Notes form using LotusScript?

You can use the "Fields" property of the NotesForm class in LotusScript to get a list of all Lotus Notes fields on a given form design element. The LotusScript code below was adapted from an example in the Domino Designer Help database:

Set db = session.CurrentDatabase
Set form = db.GetForm("FORM_NAME")
      fieldCount = 0
      msgString = ""
      Forall field In form.Fields
        fieldCount = fieldCount + 1
        msgString = msgString & 
Chr(10) & "     " & field
      End Forall
      Messagebox form.Name & 
" has " & fieldCount & " field(s):" & 
Chr(10) & MsgString

If you were really looking to get all of the fields on a specific Lotus Notes document, you could use the "Items" property of the NotesDocument class.

Dim ws As New NotesUIWorkspace
Dim doc As NotesDocument
Dim strFields As String

Set doc = ws.CurrentDocument.Document
Forall i In doc.Items
strFields = strFields & Chr(10) & i.Name & " = " & i.Text
End Forall
 
Msgbox "Field Values: " & Chr(10) & strFields

Do you have comments on this Ask the Expert Q&A? Let us know.

Related information from SearchDomino.com:

Dig Deeper on Lotus Domino Designer

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 ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close