In a new LotusNotes form I have a computed-value field ("NewOrdProdUID") which is set correctly with the unique ID of another existing document. I want to change the value of the field "NewProdAvail" in the existing document by means of LotusScript. I tried with this:
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim session As NotesSession
Dim db As NotesDatabase
Dim ws As New NotesUIWorkspace
Dim uidoc As notesUIDocument
Dim odoc As notesDocument
Set session = New NotesSession
Set db = session.CurrentDatabase
Set uidoc = ws.CurrentDocument
Set odoc = db.GetDocumentByUNID(uidoc.FieldGetText("NewOrdProdUID"))
Call odoc.FieldSetText("NewProdAvail", "0")
Call odoc.Save(True, True)
End Sub
However the value of the field "NewProdAval" stays the same (3 in my case, not 0). Please, help me!
Strange, it seems like you should be getting an error too. You are calling a front-end method for NotesUIDocument on your NotesDocument object (odoc), and the NotesDocument class does not have a method called "FieldSetText". This should fix the problem:
Instead of Call odoc.FieldSetText("NewProdAvail", "0"), try this
Call odoc.ReplaceItemValue("NewProdAvail", "0")
Hope this helps!