Pages

Wednesday, August 3, 2011

Force UNID on a new document - UNID Hack

Recently I happened to do some thing that required me to force unid on a newly created document. The use cases that I could think about for this kind of scenario are very use ful. Say for example deleting a document by accident may lead to orphan response documents if not taken care of. And if you want to bring them back on association and not screw up things we can use this little tip.

The use is very simple,Following is a lotus script code that will do it for you. Note the way document items are being copied using CopyAllItems command.

Set selDoc=currDB.UnprocessedDocuments.GetFirstDocument

Set newDoc=trgDB.Createdocument
newDoc.UniversalID=selDoc.UniversalID
Call selDoc.CopyAllItems(newDoc)
call newDoc.save(true,false)
 
And the normal rules apply, a multiple documents can't have same unid with in the same database.
 
Excersice caution while using this cos, you might just screw up things if you are not cautios. After all we know the importance of the UNID

No comments:

Post a Comment