Create breadcrumbs (Notes)

The following code lets you store breadcrumbs on a document, based upon the parent-child relation.

Function GetDocumentCategory(doc As notesdocument) As String
Dim session As New notessession
Dim db As notesdatabase
Dim node As notesdocument
Dim Category As String
Set node = doc

Set db = session.currentdatabase

Do While node.isResponse
If node.isvalid Then
Set node = db.getdocumentbyunid(node.parentdocumentunid)
If Category = “” Then
Category = node.Title(0)
Else
Category = node.Title(0) & “\” & Category
End If
End If
Loop

GetDocumentCategory = Category
End Function

Call the function somewhere, for example the querysave event on a form:

Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim doc As notesdocument
Set doc = source.document
Call doc.replaceitemvalue(“Path”, GetDocumentCategory(doc))
End Sub

Advertisements

One thought on “Create breadcrumbs (Notes)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s