Set a value in a field existing in another Lotus Notes database
Learn the LotusScript code you'll need to use to set a value in a Lotus Notes field that resides in a different Lotus Notes database.
How do I set a value in a field that resides in a different Lotus Notes database?
To set a field on a document in another Lotus Notes database, you must create LotusScript or Java code for that specific Lotus Notes database object. Ideally, the code will locate the Lotus Notes document -- using a view lookup, full-text search, or by the Unique Notes Identification Number (UNID) -- and then update its value on that Lotus Notes document. Remember to save the Lotus Notes document after updating the field, or the changes will not be saved.
Your code should look something like this:
Dim session As New NotesSession Dim dbTarget As NotesDatabase Dim docTarget As NotesDocument Set dbTarget = session.GetDatabase ("Server", "filename.nsf") If (dbTarget.IsOpen) Then Set docTarget = dbTarget.GetDocumentByUNID ("document UNID") If Not (docTarget Is Nothing) Then Call docTarget.ReplaceItemValue ("field_name", "new_value") Call docTarget.Save (True, False) End If End If
Do you have comments on this Ask the Expert Q&A? Let us know.
Related information from SearchDomino.com:
- Tutorial: 30 LotusScript tips
- 10 tips in 10 minutes: Top LotusScript tips
- Expert Advice: Setting the field value of a table
- Reference Center: LotusScript
- Reference Center: Lotus Domino Designer