Jake, how would I take the selected document and pre-fill fields on a new
document, then open and display that new document? I was trying to do the same
thing you were doing with an agent but not successful.
Here is my agent code: Can you help?
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim newdoc As NotesDocument
Dim item As NotesItem
Dim value As String
Set db = session.CurrentDatabase
Set view = db.GetView("all")
'Set context = session.DocumentContext
Set item = doc.GetFirstItem("processdocs")
Forall v In item.values
Set doc = db.GetDocumentByUNID( v )
Set newdoc = db.CreateDocument
newdoc.Form = "Status"
newdoc.Project_Title = doc.Project_Title(0)
newdoc.Priority_Number = doc.Priority_Number(0)
newdoc.Status_report = doc.Status_report(0)
newdoc.Phase_update = doc.Phase_update(0)
newdoc.When_get = doc.When(0)
newdoc.Phase_get = doc.Phase(0)
newdoc.When_update = doc.When_update(0)
newdoc.When = doc.When(0)
newdoc.Phase = doc.Phase(0)
newdoc.Stat_Post = doc.Stat_Post(0)
newdoc.SR_Date = Now()
'newdoc.year = Now(year)
'newdoc.month = Now(month)
doc.Stat_update = "No"
newdoc.Stat_update = "No"
newdoc.DocumentNumber = doc.DocumentNumber(0)
newdoc.report_date = doc.report_date(0)
doc.ParentID = doc.UNID(0)
newdoc.NeCom = "y"
newdoc.Owner = doc.Owner(0)
Call newdoc.Save( True, False)
Call doc.Save( True, False)
doc.builtflag = "y"
End Forall
'Call view.Refresh
End Sub
Jake, how would I take the selected document and pre-fill fields on a new document, then open and display that new document? I was trying to do the same thing you were doing with an agent but not successful.
Here is my agent code: Can you help?
Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim view As NotesView Dim doc As NotesDocument Dim newdoc As NotesDocument Dim item As NotesItem Dim value As String Set db = session.CurrentDatabase Set view = db.GetView("all") 'Set context = session.DocumentContext Set item = doc.GetFirstItem("processdocs") Forall v In item.values Set doc = db.GetDocumentByUNID( v ) Set newdoc = db.CreateDocument newdoc.Form = "Status" newdoc.Project_Title = doc.Project_Title(0) newdoc.Priority_Number = doc.Priority_Number(0) newdoc.Status_report = doc.Status_report(0) newdoc.Phase_update = doc.Phase_update(0) newdoc.When_get = doc.When(0) newdoc.Phase_get = doc.Phase(0) newdoc.When_update = doc.When_update(0) newdoc.When = doc.When(0) newdoc.Phase = doc.Phase(0) newdoc.Stat_Post = doc.Stat_Post(0) newdoc.SR_Date = Now() 'newdoc.year = Now(year) 'newdoc.month = Now(month) doc.Stat_update = "No" newdoc.Stat_update = "No" newdoc.DocumentNumber = doc.DocumentNumber(0) newdoc.report_date = doc.report_date(0) doc.ParentID = doc.UNID(0) newdoc.NeCom = "y" newdoc.Owner = doc.Owner(0) Call newdoc.Save( True, False) Call doc.Save( True, False) doc.builtflag = "y" End Forall 'Call view.Refresh End Sub