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:

This was last published in January 2008

Dig Deeper on Lotus Domino Designer

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close