Hi, I’ve searched the forum and found several close responses (including one of mine!) but am still having a problem figuring this out.
I’m not a Lotus Script guru, and am unable to figure this out from the Help or from the Forum.
What I’m trying to do is update one field on all related response docs, from a response doc.
So if I change the field on one response doc, I would like to:
-
Grab it’s parent
-
Grab all that parents children (responses),
-
Update those reponses to match the response doc field I just changed.
-
Save newly changed collection response.
-
Refresh view if possible
I’ll be doing this in the Post Save - unless there’s a better way.
Here’s what I’ve got so far (producing the ‘variant does not contain an object’ error)
Sub Postsave(Source As Notesuidocument)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim ProgramChoice As String
Dim collection As NotesDocumentCollection
Dim currentResponse As NotesDocument
Dim parentid As String
Dim parent As NotesDocument
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
'Get parent UNID of the current response doc
parentid = doc.ParentDocumentUNID
'Get parent document
Set parent = db.GetDocumentByUNID(parentid)
'Get all responses to parent
Set collection = parent.Responses
Set currentResponse = collection.GetFirstDocument
While Not ( currentResponse Is Nothing )
Call currentResponse.ReplaceItemValue("Emp_SingleContactProgam", uidoc.fieldgettext("Emp_SingleContactProgam"))
Call currentResponse.Save(True,False)
Set currentResponse = collection.GetNextDocument(currentResponse)
Wend
End Sub
I think it’s because I don’t know how to handle, or tell the difference between when to use uidoc and doc.
Based on suggestions in this forum I’ve also tried using stampall to no avail.
I think this is the closest I’ve come but it’s still not working.
If anyone has any suggestions or tips they would be much appreciated.
Thank you