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:
Dig Deeper on LotusScript
Related Q&A from Brad Balassaitis
Upon moving to Lotus Notes 8, some Lotus Notes users received an error message stating: 'Database has not been opened yet.' Find out why here. Continue Reading
Discover what security settings you need to fix if you encounter the Lotus Notes database error: 'database is not opened yet.' Continue Reading
Learn the Formula language code that you can use if you'd like your Lotus Notes form with embedded views to stop displaying all response documents. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.