Lotus Notes DXL to remove Design Element Inherit from the design template

otusThere is no easy way in Domino Designer Client to clear the “Inherit from the design template” design element property from all design elements. The best you can do is to view all the forms, highlight those that show as inheriting from a design template as clear the property. But you have repeat this for Forms, Views, Agents, Script Libraries, etc.

When copying and pasting design elements from one database to another, if the source database is defined as a template then the following dialog box will appear:

If you answer yes to this prompt then the design element will be set to inherit from the source database.

To clear the property from all design elements use the following Agent code, which uses DXL to export, update and overwrite the design element.
Sub Initialize

Dim session As New NotesSession
Dim db As NotesDatabase
Dim note As NotesDocument
Dim noteCollection As NotesNoteCollection
Dim stream As NotesStream
Dim domParser As NotesDOMParser
Dim exporter As NotesDXLExporter
Dim importer As NotesDXLImporter
Dim attrib As NotesDOMAttributeNode
Dim nid As String
Dim found As Boolean
Dim i As Integer

Set db = session.CurrentDatabase

'Get a note collection of all the design elements
Set noteCollection = db.CreateNoteCollection(False)
noteCollection.SelectAllFormatElements False
noteCollection.SelectAllDesignElements True

'Loop through the note collection
nid = noteCollection.GetFirstNoteId
For i = 1 To noteCollection.Count
Set note = db.GetDocumentByID(nid)

'Create a stream to store the DXL export output
Set stream = session.CreateStream
Set exporter = session.CreateDXLExporter
'Create a DOMParser to manage the DXL
Set domParser = session.CreateDOMParser(exporter, stream)
'Export the design element to the DOMParser
exporter.SetInput note
exporter.SetOutput domParser

'Get the fromtemplate attribute from the exported XML
Set attrib = domParser.Document.DocumentElement.GetAttributeNode("fromtemplate")

'If the fromtemplate attribute exists and is not blank we need to blank it and import the DXL
If attrib.isNull = False Then
If attrib.AttributeValue <> "" Then
attrib.AttributeValue = ""
'Serialize the DXL so the importer has data to work with
Set importer = session.CreateDXLimporter(stream, db)
End If
End If

nid = noteCollection.GetNextNoteId(nid)

End Sub


Grill Been said...

Software makes defend changes in our programming with the help of custom writing reviews. Many people use these for the improvement and for better results. People might get latest information while using upgrading techniques. Many people may use such software for their easily solution of their problems.

Andre Guirard said...

Don't do this. DXL is not 100% fidelity for round trip. The information is stored in an item in the design note so you can open the design element as a NotesDocument object, delete that item, sign the note, and you're good to go.