How to set the template version on a Notes (Lotus/IBM/HCL) application master template

480 views Asked by At

I am updating an existing Notes application with some minor changes. When I developed the original application some time ago (>10 years), I originally built a master template and assigned a version to the master template. The standard release practise in the environment is to build in a dev environment, make a template from dev which is then used to refresh the databases in the test environment and then ultimately used to refresh the production environment databases also.

Master Template Version

I don't recall how I was able to set the version text on the master template, nor have I been able to find any information on how this can be done. I recall the process with more of a 'hack' than something that was available as a standard developer feature.

Is anyone familiar with the process to set/update the template version on a master template?

2

There are 2 answers

1
Scott Leis On BEST ANSWER

I have an agent with the following code to set the template version. I run the agent manually from the template before refreshing the design of a database based on the template.

This wasn't originally my code. I found it somewhere on the internet many years ago, and have made only minor changes.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim nc As NotesNoteCollection
Dim doc As NotesDocument
Dim iCount%,sNoteID$,tmp$

Const ITEM_BUILD = "$TemplateBuild"
Const ITEM_BUILD_NAME = "$TemplateBuildName"
Const ITEM_BUILD_DATE = "$TemplateBuildDate"

Set db = session.CurrentDatabase
Set nc = db.CreateNoteCollection(False)

If Not nc Is Nothing Then
    nc.SelectSharedFields = True
    Call nc.BuildCollection
    
    sNoteID = nc.GetFirstNoteId
    For iCount = 1 To nc.Count
        Set doc = db.GetDocumentByID(sNoteID)
        If Not doc Is Nothing Then
            If doc.HasItem(ITEM_BUILD) Then
                tmp=Inputbox("Enter the template name...", _
                "Template Name", doc.GetItemValue(ITEM_BUILD_NAME)(0))
                If tmp="" Then Exit Sub
                Call doc.ReplaceItemValue(ITEM_BUILD_NAME, tmp)
                
                tmp=Inputbox("Enter the version number...", _
                "Template Version", doc.GetItemValue(ITEM_BUILD)(0))
                If tmp="" Then Exit Sub
                Call doc.ReplaceItemValue(ITEM_BUILD, tmp)
                
                tmp=Inputbox("Enter the version date...", _
                "Template Date", doc.GetItemValue(ITEM_BUILD_DATE)(0))
                If tmp="" Then Exit Sub
                If Isdate(tmp) Then Call doc.ReplaceItemValue(ITEM_BUILD_DATE, Cdat(tmp))
                Call doc.Save(True, False)
                Exit For
            End If
        End If
        sNoteID = nc.GetNextNoteID(sNoteID)
    Next
End If
1
Per Henrik Lausten On

You need to update the $TemplateBuild shared field with a date in $TemplateBuildDate (and similarly you can set the name in $TemplateBuild).