Agent property: Store search in search bar menu

Does anyone know in what context this option can be used? The option is not considered in documentation. Same question applies for ‘Store highlights in documents’.


XPages and WQO agents – Cardscan app

I would love to rebuild my Cardscan integration application with XPages and make it an OpenNTF project, the only BUT is  that the transfer of the data that comes from Cardscan is done via a WQO agent in LotusScript.

I wonder if there are examples out there that proof it IS possible using WQO agents in XPages? It would save me a hell of a time and probable if it is not possible I would not do the transformation of the app att all (I am not a Java guy).

So hints/demo/code etcetera are welcome…

jQuery TreeView Menu from Notes View

I was looking for a way to get a web publishing toolkit in Notes away from displaying documents in a frameset.

The frameset consists of several frames:

  • a header section
  • a leftside navigation section
  • a main or content section

The reason why a frameset is used because the leftside navigation is populated from documents in a Notes View.  This navigator would be collapsed again every time it would be re-loaded again.  It is also build by an agent that generates XML which needs to be transformed in the browser.

Here is how it looks today:


Some searching on the web brought me to these documents:

jQuery TreeView Menu and a Show ‘n Tell Thursday blogpost. Combining the 2 topics would solve my problem since the jQuery TreeView allows to re-open the treemenu by the location specified for a menu item!

( I will add the SnTT tag to this document to honour the contributors, even when it is now still Thursday)

I soon discovered that the code for the Tree Convertor from Datatribe works with documents in the same level, meaning that documents with a response hierarchy will not be supported because you do not use categorized columns in your View. Nevertheless a little trial and error and rewriting the original code resulted in the following Notes View presented as a tree:


Note: in the example I have already applied some styling.

In this View each ‘Category’ is a document containing one or more response documents. The highlighted (red) item is the currently opened document.

So how do you get there?

  • Create a Notes View that displays your documents as you want them to be presented in the tree. In the Datatribe example this View is called (LUDocs).


  • Upload all the fields you need for the jQuery TreeView (CSS, Images, JS Libraries) and reference to them in the Head section of your Document Form:


  • Add the fuction that will transform the HTML list into a Tree View structure.


Note:  -the persist: “location”- parameter ensures that the tree will be expanded by the item / document opened by default.

  • On the place where you want to display the TreeView add the following code:


As you can see a script is here called which uses an Agent to collect the data from a Notes View in an HTML format ( ul and li list format). I had to make come changes to the original code, since I am using a View that support the display of response documents in a hierarchy.

Sub Initialize
‘—This agent is designed to ouput the required javascript to produce a nested HTML list
On Error Goto errorhandler

Dim s As New notessession
Dim db  As NotesDatabase
Dim doc As NotesDocument

‘–Category passed in via URL
Dim inCategory As String

‘—View name passed in via URL
Dim viewName As String

‘—Display Category ?
Dim displaycategory As String

‘—Document in the view
Dim tmpdoc As notesdocument

‘–Category Level
Dim level As Integer
‘—Current Category level
Dim currentLevel As Integer

Dim view As NotesView
Dim i As Integer
Dim JavascriptOutput As String

‘—Due text size limits we need to hold the ouput on 1 or more temporay notes items (never saved)
Dim fieldCounter As Integer
Dim holdingField As Notesitem

Set doc=s.documentcontext

‘–Set up holding field
Set holdingField=New notesitem(doc,”HoldingField_” & fieldCounter,””)


Set db=s.currentdatabase


If displaycategory=”false” Then

If inCategory=”” Then
JavascriptOutput=JavascriptOutput & |<h3>All Documents</h3>|
JavascriptOutput=JavascriptOutput & |<h3>| & inCategory & |</h3>|
End If
End If

JavascriptOutput=JavascriptOutput & |<ul id=”tree”>|

‘—-View could be passed in via QueryString to allow a more generic agent
Set view=db.GetView(viewName)

‘—If view is not found handle it – as the view name is passed in this could be missing
If view Is Nothing Then
Print |Content-Type:text/plain|
Print |document.write(‘Error – View not found -| & viewName & |’)|
Goto getout
End If

Dim entry As NotesViewEntry
Dim nav As NotesViewNavigator
If inCategory=”” Then
Set nav = view.CreateViewNav
Set nav = view.CreateViewNav
End If
Set entry=nav.GetFirst

Dim edoc As NotesDocument
Dim childdoc As NotesDocument
Dim coll As notesdocumentcollection

While Not(entry Is Nothing)

Set edoc = entry.Document
Set coll = edoc.responses

If coll.Count > 0 Then
Select Case (entry.ColumnIndentLevel+1)
Case level
JavascriptOutput=JavascriptOutput & |</ul></li>|
Case Is<level
For i=2 To ((level)-entry.ColumnIndentLevel)
JavascriptOutput=JavascriptOutput & |</ul></li>|
End Select

‘–Update level

‘–Propercase it
JavascriptOutput=JavascriptOutput & |<li><strong><a href=”http://| & returnCommonServer() & |/| & swapchars(db.FilePath,”\”,”/”) & |/0/| & entry.UniversalID & |”>| & edoc.Tx_Document_Title(0) &|</a></strong><ul>|
‘—At document
Select Case (entry.ColumnIndentLevel+1)
Case level
JavascriptOutput=JavascriptOutput & |</ul></li>|
Case Is<level
For i=2 To ((level)-entry.ColumnIndentLevel)
JavascriptOutput=JavascriptOutput & |</ul></li>|
End Select

‘–Update level

Set tmpdoc=db.GetDocumentByUNID(entry.UniversalID)
Set tmpdoc=entry.Document
If tmpdoc.Tx_Document_Title(0)<>”” Then
JavascriptOutput=JavascriptOutput & |<li><a href=”http://| & returnCommonServer() & |/| & swapchars(db.FilePath,”\”,”/”) & |/0/| & entry.UniversalID & |”>| & fn_escape(Cstr(tmpdoc.Tx_Document_Title(0))) & |</a></li>|
End If
End If

‘–Check for field size
Call holdingfield.appendtotextlist(JavascriptOutput)
Call monitorFieldSize(doc ,fieldCounter,holdingField)
Set entry=nav.GetNext(entry)

‘–Now we have finished we need to close the remaining tags
For i=1 To (currentLevel-1)
JavascriptOutput=JavascriptOutput & |</ul></li>|

Call holdingfield.appendtotextlist(JavascriptOutput)

‘—-Now output Javascript

Print |Content-Type:text/plain|
Print |document.write(‘\n’+|
If fieldcounter=1 Then
Forall items In doc.GetItemValue(“HoldingField_1”)
Print|’| &  items & |\n’+|
End Forall
For i=2 To fieldcounter
Forall items In doc.GetItemValue(“HoldingField_” & i)
Print|’| & items &  |\n’+|
End Forall
Forall items In doc.GetItemValue(“HoldingField_1”)
Print|’| & items  |\n’+|
End Forall
End If
Print |’\n’)|

Exit Sub


‘—As this is an agent that expects to return JavaScript we will return the error message in Javascript
Print |Content-Type:text/plain|
Print |document.write(‘Error – | & Error & | – | & Err & |’)|

Resume getout

End Sub

That is about it! Here is a better look of the result:


Maintaining the universal identifier when copying documents from one App. to another

I received an incident that some documents where removed from an application in production. Since it was not sure when the documents where deleted and what other changes have occured in the application the quickest way was to quickly copy the documents from the recovery database back into the production database.

Unfortunately the documents are being linked on our intranet so a copy and paste action would modify their universal ids.

This code will reset the universal ID to the one of the original even though a copy is being made via an agent:

Sub Initialize

Dim ws As New NotesUIWorkspace

Dim destinationDb As New NotesDatabase( “ServerName”, “directory\application.nsf” )

Dim uiView As NotesUIView

Set uiView = ws.Currentview

Dim dc As NotesDocumentCollection

Set dc = uiView.Documents

Dim orgDoc  As NotesDocument

Dim newDoc  As NotesDocument

Dim junkUNID As String

Dim dontWantThisDoc  As NotesDocument

Set orgDoc = dc.GetFirstDocument

Do Until (orgDoc Is Nothing)

Set newDoc = orgDoc.CopyToDatabase(destinationDb)

junkUNID = newDoc.UniversalID

newDoc.UniversalID = orgDoc.UniversalID

Set dontWantThisDoc = destinationDb.GetDocumentByUNID(junkUNID)

‘Call dontWantThisDoc.Remove(True)

Set orgDoc = dc.GetNextDocument(orgDoc)


End Sub

The Lotus Symphony Developer’s Workshop


Symphony API
Symphony API

Today I received a question from a developer who received the question from a customer to store Notes documents as PDF’s via a scheduled agent.

I remember the workshop “The Lotus Symphony Developer’s Workshop” @Lotusphere where in one of the excercises you transformed Symphony documents as PDF’s.

John D. Head wrote in the BP110 presentation:

“We can use a Java Agent to automate Symphony”,

which tends me to say: Yes, it should be possible to convert Lotus Notes documents to PDF using Lotus Symphony on a scheduled basis. Or am I wrong?

Ps. Has anyone the material/excercises/instructions from this hands-on lab?

Elastic Calendar Styling with CSS

Today is my last day in the office before I will enjoy a well deserved summer holidays (here in Sweden my Swedish collegues are already 3 weeks ahead of me). So this last day I was pretty much done with projects so I had some time free to try something new.

In my ‘action folder’ on my desktop there was still an article waiting to be picked up for … something … so I decided to do this today. Like the article-title ‘Elastic Calendar Styling with CSS‘ says some nice calendering can be made just using CSS.

What I have done is placed the code and logic in an Agent, so when you run the Agent in the browser you will get for this month something nice that looks like this:

calendar example
calendar example

Note: the Agent uses the time on your local machine so by changing your date (month) you get a different result. Well I can see some possibilities…

If you are curious, here is a downloadable example. Well I am off for holidays and some happy camping. Hej så länge!