Manage Learn to apply best practices and optimize your operations.

Creating a Notes form dynamically

How to create a Notes form dynamically -- create a form with labels and fields, using LotusScript.

I always wanted to create a Notes form dynamically -- with labels and fields, using LotusScript. I realized that using XML with Lotus Notes R6 was the answer: XML for Lotus = DXL.

You can use DXL technology for both exporting and importing Notes design elements. See the R6 Design Help database for an example of exporting design elements (see CreateDXLExporter method). The DXL file exported all database designs, not just a single design element!

The tricky part was importing just a form design definition consisting of labels and text fields (no fancy formatting only bold labels). Studying an exported DXL file, I finally I found the right DXL file for a simple form definition --a file I can use with .CreateDXLImporter method.

Here is a sample DXL file:

<?xml version='1.0' encoding='utf-8'?>
 <!DOCTYPE form SYSTEM 'domino.dtd'>
 <form name='CDAO-64TLV5' xmlns=
'' version='1.01'>
  <pardef id='1'>>
  <par def='1'/>

<par><run><font style='bold'/>
My label 00:
<par><field type='text' kind='editable' 
<par><run><font style='bold'/> 
My label 01:
<par><field type='text' kind='editable' 
<par><run><font style='bold'/> 
My label 02:
<par><field type='text' kind='editable' 
<par><run><font style='bold'/> 
My label 03:
<par><field type='text' kind='editable' 


The structure of the sample DXL is rather simple:

Label nn:
[textfield nn]

Below is how to import the above DXL file in R6 using LotusScript.

I suggest you:

  • Pay attention to the DXL import file (no blank line at the top of the file, open/close XML tags, etc.).
  • Study a DXL database output to see how Notes and text fields are translated in XML (bold, field types).
Sub importDXL(filedxl As String)
 On Error Goto myerror
 Dim stream As NotesStream
 Set stream = sess.CreateStream
 If Not stream.Open(filedxl) Then
  Msgbox " importDXL() - Error importing file " 
& filedxl 
  Exit Sub
 End If
 If stream.Bytes = 0 Then
  Msgbox "File does not exist!" & filedxl
  Exit Sub
 End If
 Dim importer As NotesDXLImporter
 Set importer = sess.CreateDXLImporter
(stream, db)
 importer.ReplaceDBProperties = True
 = False
 importer.ACLImportOption = 
 importer.DesignImportOption = 
 Call importer.Process
 Exit Sub
 Msgbox "importDXL() - " & Err & " -
 " & Error & " code line: " & Erl
 Exit Sub
End Sub

Do you have comments on this tip? Let us know.

This tip was submitted to the tip exchange by member Cristian D'Aloisio. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Dig Deeper on XML and Web Services for Lotus Notes Domino

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...