Category Archives: Lotus Notes

Lotus Notes and Git

If multiple developers are working on a project it is possible that they do development on their local machine(Lotus Domino server is installed on their local machine). Everybody is working on separate module so they can work independently. After the development is complete we need to merge the changes done by every developer into single nsf file so that we can deploy. We used to make a list of design elements which we have modified/created/deleted during the development process, and based on that list from every developer we do merging. Since we are human, we are bound to make mistakes. This list is created manually so there is a possibility to make mistakes or miss out something. So after merging process all unit tests must be executed to ensure all changes has been merged.

To avoid this mistake and overhead of unit testing again and again, we need to automate this process. Let me tell you how we can automate it and ensure it would not break our application.

  1. Install Git on all developers machines for version controlling. This step is not required but it will help during merging process if some conflict arise. Git will give you list of all design elements which are created/modified/deleted without any error.
  2. There are two possibilities, either Git is installed on all developers machine or it is not installed on some/all of developers machine
    1. If Git is installed on all machines: We can use Git pull request to pull and merge all changes made. If a conflict arise(conflict arise only when if a change is made on same line and same file by two or more developers) Git will ask you how to resolve the conflict. We can select manual resolution to ensure we are not going to lose anything
    2. If Git is not installed:
      1. take ntf from all developers(e.g., app1.ntf, app2.ntf, app3.ntf, …)
      2. Create nsf(app.nsf) from first ntf(app1.ntf) and set up version controlling using Git for it.
      3. By default Git creates a branch and call it “master”. Commit all changes in master branch
      4. Create a new branch “app2″ and switch to this branch
      5. Go to Lotus Notes workspace and replace design of created nsf(app.nsf) with design of next template(app2.ntf). Once design replace is completed, it will automatically export all changes to Git repository.
      6. Commit all changes in current branch
      7. Perform step iii – vi for all templates
      8. Now we have all design changes recorded in Git on separate branches, we just need to merge it. Merge “app2″ branch with “master” branch and commit it, then merge next branch with master.
      9. Once this merging process is complete, open Domino Designer and sync the application with on disk project.
      10. You are done. Nothing more to do.

I explained above how can we use Git in our development environment and it gives us flexibility to work in distributed manner. It do not enforce all of us to use it. If few of us are not comfortable in using it they can easily avoid it without any complexity. If you are new to Git, I recommend you to read this documentation.

Make data table row clickable using dojo

To make the entire row clickable copy below code and paste it in on load event of the XPage.


I was given a task to list down all controls and theirs labels along with some other attributes like style, style class, parent id, etc and prepare an Excel sheet. It was so boring and tedious task for me. This is a repetitive task in which I need to copy attributes value and paste it to the Excel sheet. I decided to automate this task and wrote this piece of code which simplifies my task drastically.

Paste above code in the script library and following code in afterPageLoad event of XPage

Now preview your XPage into the browser. A list of documents has been created in the application with form name fDoc. Create a view to display all these documents and its field values.

XPage – Sort View Column

I was searching for a work around to allow view column to be sortable by clicking on column header but I was not able to find any reliable solution using View Panel. Now I found a way to provide this feature using Repeat Control or Data Table.

Please go through the following code.
var loView:NotesView = null;
var loEntryColl:NotesViewEntryCollection = null;
var loTreeMap:java.util.TreeMap = new java.util.TreeMap();
var lsSortBy = viewScope.get(“sortBy”);
try {
loView = database.getView(“view”);
if(null == lsSortBy || “” == lsSortBy) {
lsSortBy = 0;

if(null != loView && loView.getEntryCount() > 0) {
loEntryColl = loView.getAllEntries();
var loEntry:NotesViewEntry = loEntryColl.getFirstEntry();
var loTempEntry:NotesViewEntry = null;
while(null != loEntry) {
loDoc = loEntry.getDocument();
var lsKey = loEntry.getColumnValues().get(lsSortBy);

while(loTreeMap.containsKey(lsKey)) {
lsKey += “~”;

loTreeMap.put(lsKey, loEntry.getColumnValues());

loTempEntry = loEntryColl.getNextEntry(loEntry);
loEntry = loTempEntry;
} catch(e) {
print(“Error : ” + e);
} finally {
if(null != loView) loView.recycle();
if(null != loEntryColl) loEntryColl.recycle();

return loTreeMap.values();

In line 3 I am defining a TreeMap data structure. By definition TreeMap is sorted according to its natural ordering of its keys.

Since the data structure is always sorted so we can insert NotesViewEntry column values to the TreeMap and the corresponding column value (by which the view needs to be sorted) should be passed as key.

Look at line no 17 I am forming the key by which the view needs to be sorted. By default it is first column value.

At this point of time the only thing which creates problem is the duplicate values of the key. In TreeMap the value is overwritten if the key is already existing.

From line 18-21 I am appending additional character to make the key unique.

In line 37 I am returning value set from the TreeMap which is already sorted by key.

Rest of the code is quite easy to understand. I hope it may help in your application.

Optimization of the above code is discussed in next blog.