P
PavelT100
Создаю документ, сохраняю его, вызываю агент и выполняю его на сервере передав NotesID агенту. Модифицирую и сохраняю документ в агенте. Агент выполнился успешно. Перечитываю документ - но изменений которые сделал агент не вижу. Почему так ? Если вызвать другой агент и передать ему тот же самый NotesID, то в этом агенте документ будет правильный, модифицированный.
а это код агента
Код:
Dim s As New NotesSession
Dim db As NotesDatabase
Set db = s.CurrentDatabase
Dim ws As New NotesUIWorkspace
Set uidoc = ws.CurrentDocument
Dim doc As NotesDocument, cfgdoc As NotesDocument
Set doc = uidoc.document
Set cfgdoc = db.CreateDocument
cfgdoc.Form = "DLG_LastCfg"
cfgdoc.WebLogin = doc.WebLogin(0)
cfgdoc.Versions = "???"
Call cfgdoc.Save(True, False)
Dim agent As NotesAgent
Set agent = db.GetAgent("GetCfg")
If agent.RunOnServer(cfgdoc.NoteID) = 0 Then
Messagebox "Agent ran",, "Success"
Else
Messagebox "Agent did not run",, "Failure"
End If
Dim cfgdoc1 As NotesDocument
Set cfgdoc1 = db.GetDocumentByID(cfgdoc.NoteID)
'здесь cfgdoc1.Versions все еще равна "???"
а это код агента
Код:
Sub Initialize
Print "GETCFG BEGIN"
Dim s As New NotesSession
Dim agent As NotesAgent
Set agent = s.CurrentAgent
Print "ParameterDocID = " & agent.ParameterDocID
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set doc = db.GetDocumentByID(agent.ParameterDocID)
If Not(doc Is Nothing) Then
doc.Versions = "95,98"
Print "GETCFG - " & doc.UniversalID & " WebLogin = " & doc.WebLogin(0)
Print "doc.Versions - " & doc.Versions(0)
Dim fl As Boolean
fl = doc.Save(True,False)
Print "fl - " & fl
Else
Print "GETCFG Error"
End If
End Sub