Hi,
I’m trying to design an agent that will append values to a field depending on what users choose from a dialog box.
The first part of the agent will prompt users with a dialog box from a static form that I have created. The values in that form will not change.
Depending on whether they choose a certain value from the dialog box, a 2nd dialog box will appear. I would like the values in this dialog box to be dynamic, depending on what values are already present in the underlying form. Eg, if the values in the ‘Liaison Branches’ field in the underlying doc contain ‘A’, ‘B’ and ‘C’, I would like the dialog box to show these values and prompt the user which one to tick, which will then update another field on the document. Hope this makes sense, I have some sample code below.
When I’m looping through the ‘Liaison branches’ in ‘doc’, I’m able to messagebox back the values, but not append these to the ‘tempdoc’ I’ve created (it comes up with an error). Hope someone can help!
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim docCollection As NotesDocumentCollection
Dim doc As NotesDocument
Dim ws As New NotesUiWorkSpace
Dim tempdoc As NotesDocument
Dim tempdoc2 As Notesdocument
Dim item As NotesItem
Dim nam As NotesName
Dim CommonName As String
Dim item2 As NotesItem
Set db = s.CurrentDatabase
Set docCollection = db.UnprocessedDocuments
Set doc = docCollection.GetFirstDocument
Set tempdoc = db.CreateDocument
Set item = doc.GetFirstItem( "Approvals" )
Set nam = New NotesName(doc.GetItemValue("LeadBriefingOfficer")(0))
Set tempdoc2 = db.CreateDocument
CommonName = nam.Common
tempdoc.form = "CheckboxRetickDialog"
tempdoc2.form = "LiaisonBranchList"
Set item2 = tempdoc2.GetFirstItem( "BranchList" )
Call ws.Dialogbox("CheckboxRetickDialog", True,True, False, False, False, False, "Select the checkbox to retick", tempdoc)
Forall values3 In doc.LiaisonBranches
Messagebox values3
Call item2.AppendToTextList(values3)
End Forall
Forall values In tempdoc.SubmissionSelection
Select Case values
’ Case “Liaison Branch”
’ Call ws.Dialogbox(“LiaisonBranchList”, True,True, False, False, False, False, “Select Liaison Branch”, tempdoc2)
’ Call ws.Dialogbox(“tempdoc2”, True,True, False, False, False, False, “Select Liaison Branch”, tempdoc2)
’ Forall liaisons In tempdoc2.BranchList
’ Call item.AppendToTextList("Liaison Branch: " + liaisons)
’ Call Doc.Save(False, True)
’ End Forall
Case "Lead Branch"
Call Item.AppendToTextList("Lead Branch: " + doc.LeadBranch(0))
Call Doc.Save(False, True)
Case "Deputy Secretary"
Call item.AppendToTextList("Deputy Secretary")
Call Doc.Save(False, True)
Case "Author"
Call item.AppendToTextList("Author: " + CommonName)
Call Doc.Save(False, True)
End Select
End Forall
End Sub