Domino Code Fragment

Code Name*
Compute With Form
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.135.216.174
Description*
This agent runs on a selected document. When run it "recomputes" the form. I use this a lot when I need to change something like a reader field that is computed when composed. Instead of adding an additional readers field to a form and then modifying each form this will allow you to recompute the values of such fields after you have changed the field formula. This is handy especially if you forget to give yourself access to certain fields (in which case you have to run this at the server) but it can save a lot of time and heartache.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:

Dim selecteddocs As NotesDocumentCollection
Set session = New NotesSession
Set ws = New NotesUIWorkspace


Set selecteddocs = session.CurrentDatabase.UnprocessedDocuments

If (selecteddocs.Count = 0) Then
Messagebox "Please select one or more documents before executing this command.",16,"Error"
Exit Sub
End If


'if there is a document currently open, and it is a new document, we cannot proceed
Set uidoc = ws.CurrentDocument


Set doc = selecteddocs.getfirstdocument

Call doc.ComputeWithForm(False,False)
Call doc.save(False,False)