LS Help - point me in the right direction

I have a training records database with a handful of forms. There’s three very simple forms used to imput the employees, instructors, and courses. Then I have a slightly more advanced form that does lookups on views so you can link an employee to a specific course, instructor, etc. Rather than input one record at a time the user has asked for something where she can select multiple employees and create records for them all with the same criteria.

I’ve got a good start to this. My agent below allows you to select multiple employee records, pulls the employee name from the document, and then creates a new training record with that employees name. I’m a little lost on how to do the next step though. If possible I’d like to be able to prompt her with message boxes that lists the courses / isntructors and let her pick from a listbox or combobox. Then save those values to each of the forms too. Not sure if that’s possible or what functions I should be looking at. Can someone point me in the right direction. Thanks,

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim dc As NotesDocumentCollection

Dim doc As NotesDocument

Dim newdoc As NotesDocument

Dim itemname As String

Dim success As Variant	



Set db = session.CurrentDatabase

Set dc = db.UnprocessedDocuments

Set doc = dc.GetFirstDocument()



Do Until (doc Is Nothing)

	Set newdoc = db.createdocument

	itemname = doc.EmpName(0)

	newdoc.Employee = itemname

	newdoc.form = "Training"

	success = newdoc.ComputeWithForm(False, False)

	If success Then

		Call newdoc.save(True, True)

	End If

	Set doc = dc.GetNextDocument(doc)			

	Call session.UpdateProcessedDoc(doc)		

Loop

End Sub

Subject: LS Help - point me in the right direction

If I was doing this I would use the NotesUIWorkspace.DialogBox method. It allows you to display a form in a modal dialog box. You simply place the picker controls that you want on the form and pass the form name as one of the many parameters to the dialogbox method call. Once the call ends with the user clicking on an OK or cancel button you still have access to the document that was “behind” the dialog box and you can harvest any values that you need off it.

Subject: RE: LS Help - point me in the right direction

I’m looking at the help for that right now. How would that work for multiple documents though? What I had envisioned was the user selecting say 10 employees then running the agent. I’d like her to only being prompted once for the course name, instructor name, date, time, etc. Once prompted all those values along would be used in each of the 10 documents created.

Subject: RE: LS Help - point me in the right direction

Well… there’s a loop in your code that executes – let’s say – ten times because the user selected ten documents. Before the loop begins there’s some code that executes only once. Any statements that you put in that part of the code – a call to DialogBox, say – will execute only once.

Subject: RE: LS Help - point me in the right direction

Use the NotesUIWorkspace.PickListStrings method to display a view that contains your course documents. Since the course document presumably contains the instructor name, date/time, etc. for that course, you wouldn’t need multiple prompts - just a single one where the user selects which class to take.

Or, if you want the user to be able to select multiple classes, it might be easier to use PickListCollection. This will return a NotesDocumentCollection containing all the selected documents, so you can then create your main document, then loop through the collection and get all info required from each selected course document to add to the main doc.

Subject: RE: LS Help - point me in the right direction

Awesome, the pickliststring method works great. I can just use this to display a few prompts and I’m good. Thanks a lot!