Tuesday, December 22, 2009

Update all documents in a View- Lotus Notes

Recently in one of my projects, I happened to add a computed field to an existing form using which lakhs of documents have been created already.

So I had to write a one time agent that shall update all these existing documents with the new created field.

Eventually I ended up writing an agent which had a code fragment similar to the one as follows,

....get first document...
call doc.computewithform(true,false)
call doc.save(true,false)
.... loop to the next document....


But this failed. I was not able to see the newly added field in the document properties, while opening the same document in edit mode and saving the same works. It got me puzzled and now I understand that it is a issue with Lotus Notes, something similar to the doc.AppendItemValue command.

Eventually I searched through the forums and got this brilliant suggestion from a person and it said,

use @Command([ToolsRefreshAllDocs]);@All

Also the post said that the computeWithForm is not so consistent.

It saved me a lot of time and It was very fast when compared to the lotusscript agent as well.

No comments:

Post a Comment