tags:

views:

362

answers:

2

I'm working on a Domino Client application that opens documents up in a frameset.

When I click the save button it does some lotus script validation, adds to history field and etc then finally does a save:

Sub Click(Source As Button) Dim validate1 As Validation Dim ws As New NotesUIworkspace Dim s As New NotesSession Dim uidoc As NotesUIDocument Dim approverNames As String Dim workflow1 As Workflow Dim name1 As String Dim names1 As String Dim item1 As NotesItem Dim history1 As History

Set uidoc = ws.CurrentDocument
Call uidoc.refresh 

'===============================================
'Validation
'===============================================
Set validate1 = New Validation()

Call validate1.checkCustomer(uidoc.FieldGetText("Customer"))
Call validate1.checkEndUser(uidoc.FieldGetText("EndUser"))
Call validate1.checkShortProjectDescription(uidoc.FieldGetText("ShortProjectDescription"))
Call validate1.checkProjectName(uidoc.FieldGetText("ProjectName"))
Call validate1.checkProjectLocation(uidoc.FieldGetText("ProjectLocation"))
Call validate1.checkOperationCenter(uidoc.FieldGetText("BusinessUnit"))
Call validate1.checkSalesCenter(uidoc.FieldGetText("SalesCenter"))
Call validate1.checkMarketSegment(uidoc.FieldGetText("MarketSegment")) 
Call validate1.checkSAPDate(uidoc.FieldGetText("SAPDate"))
Call validate1.checkRevision(uidoc.FieldGetText("Revision"))
Call validate1.checkValidityDate(uidoc.FieldGetText("ValidityDate"))
Call validate1.checkDateApproval(uidoc.FieldGetText("DateApproval"))
Call validate1.checkCurrencyUSD(uidoc.FieldGetText("CurrencyUSD"))
Call validate1.checkMargin(uidoc.FieldGetText("Margin"))

If validate1.displayErrorMessages() = 0 Then
'========================================================================
 Call uidoc.FieldSetText("WhoHasApproved","")
 Call uidoc.FieldSetText("ApproversNotified","")  

 Call uidoc.FieldSetText("SubmitDate",Cstr(Now))
 Call uidoc.FieldSetText("Status","In Process")

 'Add calls to workflow here....
 Set workflow1 = New workflow("SAPFCD")

 'Update History Field - Submitted for Processing by
 Set history1 = New History(uidoc.Document)
 Call history1.addTo("Submitted for Processing", uidoc.FieldGetText("CreatedBy")) 
 Set item1 = uidoc.Document.ReplaceItemValue("History" , history1.getDescription())

 'Set ApproverList
 names1 = workflow1.setApproverList(uidoc)
 Call uidoc.FieldSetText("ApproverList",names1)

 uidoc.Refresh

 name1 = workflow1.setNextApprover(uidoc)  
 Call uidoc.FieldSetText("NextApprover", name1)
'======================================================================== 

 'Add calls to workflow here....
 Call uidoc.FieldSetText("Status","1st Peer")

 uidoc.Save
 uidoc.Close(True)
 uidoc.Close(True)
End If

End Sub

and then proceeds to close the entire database and returns user to workspace.

What I want is to have the document saved and then return the user to a specified page in the frame set.

I attempted to add code like this to the QuerySave event, but does not work:

Sub Queryclose(Source As Notesuidocument, Continue As Variant) Dim ws As New NotesUIworkspace ws.OpenFrameSet("MainFrame") ws.SetTargetFrame("Main")
ws.OpenPage("Saved") End Sub

Any ideas on how I can save/close a UI document that is in a frame set without it closing the entire database.

Derek

A: 

It should work fine if you only include one uidoc.close event instead of the two you have showing.

Also make sure none of the Form events PostSave/PostClose or QuerySave/QueryClose call a close event.

Jonesy
+1  A: 

Any specific reason why you have the document open within a frame of a frameset?
Usually you have a frameset for the outline and view and documents open on their own tab/window, this way when the code you have runs it only closes the doc.

**Update Did some more testing and you can insert this after the uidoc.save and remove uidoc.close

Call ws.SetTargetFrame("your frame name here") 
Call ws.ComposeDocument("","","your form name here",,,False)

I forgot to mention you should set the target frame back to "" when exiting the app, if you don't users might get error when other apps try to open up a frameset.

Carlos
Did some more testing and you can insert this after the uidoc.save and remove uidoc.closeCall ws.SetTargetFrame("your frame name here")Call ws.ComposeDocument("","","your form name here",,,False)
Carlos
I was asked to put document in frame because users were getting confused by having multiple documents open... I kept tell them that it is a training issue and that is how Mail works... but they didn't want to hear it.....
Derek