jforget1
asked on
Trouble closing window
I am having trouble closing a form after saving with LS, how can I perform these steps. I have tried both Call uidoc.Close and Call doc.close. Neither works.
Call doc.Save(True,True)
Call uidoc.Close
Else
Msgbox "This request was already recevied and is being processed."
End If
I want to do the equivalent of the code below which closes the form and takes them back to their inbox. Essesntially closes two windows.
@PostedCommand([FileSave]) ;@PostedCo mmand([Fil eCloseWind ow])
Call doc.Save(True,True)
Call uidoc.Close
Else
Msgbox "This request was already recevied and is being processed."
End If
I want to do the equivalent of the code below which closes the form and takes them back to their inbox. Essesntially closes two windows.
@PostedCommand([FileSave])
where did u placed this code? and can we see the full code? and any Form events u r placing this code?
ASKER
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim ws As New notesuiworkspace
Dim emaildoc As NotesDocument
Dim Item As NotesItem
Dim rtitem As NotesRichTextItem
'Dim sNamesArr(1)As String
Dim sNamesArrB(1)As String
Set doc = ws.currentDocument.Documen t
Set db = session.CurrentDatabase
On Error Resume Next
If doc.submit_flag(0) <> "done" Then
Set emaildoc = db.CreateDocument
emaildoc.form = "vap_submit_tracer" 'Form name of Letter
emaildoc.sendto = doc.approver(0)
sNamesArrB(0) = doc.md_name(0)
sNamesArrB(1) = doc.om_name(0)
emaildoc.CopyTo = sNamesArrB
' emaildoc.BlindCopyTo = doc.bcc
emaildoc.Principal = "Field Technology"
emaildoc.Subject = "VAP Removal Request has been submitted for " + doc.user_adjusted(0) + doc.alt_name(0) + "!"
Set rtitem = New NotesRichTextItem(emaildoc , "Doclink")
Call rtitem.AppendDocLink(doc, "")
Call emaildoc.Send(True)
doc.status = "Submitted"
doc.submit_flag = "done" 'field name for flag
Msgbox "Your request has been received and is being processed."
Call doc.Save(True,True)
Call doc.Close
Else
Msgbox "This request was already recevied and is being processed."
End If
End Sub
No other events on close.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim ws As New notesuiworkspace
Dim emaildoc As NotesDocument
Dim Item As NotesItem
Dim rtitem As NotesRichTextItem
'Dim sNamesArr(1)As String
Dim sNamesArrB(1)As String
Set doc = ws.currentDocument.Documen
Set db = session.CurrentDatabase
On Error Resume Next
If doc.submit_flag(0) <> "done" Then
Set emaildoc = db.CreateDocument
emaildoc.form = "vap_submit_tracer" 'Form name of Letter
emaildoc.sendto = doc.approver(0)
sNamesArrB(0) = doc.md_name(0)
sNamesArrB(1) = doc.om_name(0)
emaildoc.CopyTo = sNamesArrB
' emaildoc.BlindCopyTo = doc.bcc
emaildoc.Principal = "Field Technology"
emaildoc.Subject = "VAP Removal Request has been submitted for " + doc.user_adjusted(0) + doc.alt_name(0) + "!"
Set rtitem = New NotesRichTextItem(emaildoc
Call rtitem.AppendDocLink(doc, "")
Call emaildoc.Send(True)
doc.status = "Submitted"
doc.submit_flag = "done" 'field name for flag
Msgbox "Your request has been received and is being processed."
Call doc.Save(True,True)
Call doc.Close
Else
Msgbox "This request was already recevied and is being processed."
End If
End Sub
No other events on close.
Try this:
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim ws As New notesuiworkspace
Dim emaildoc As NotesDocument
Dim Item As NotesItem
Dim rtitem As NotesRichTextItem
'Dim sNamesArr(1)As String
Dim sNamesArrB(1)As String
Set doc = ws.currentDocument.Documen t
Set db = session.CurrentDatabase
On Error Resume Next
If doc.submit_flag(0) <> "done" Then
Call doc.Save(True,True)
Set emaildoc = db.CreateDocument
emaildoc.form = "vap_submit_tracer" 'Form name of Letter
emaildoc.sendto = doc.approver(0)
sNamesArrB(0) = doc.md_name(0)
sNamesArrB(1) = doc.om_name(0)
emaildoc.CopyTo = sNamesArrB
' emaildoc.BlindCopyTo = doc.bcc
emaildoc.Principal = "Field Technology"
emaildoc.Subject = "VAP Removal Request has been submitted for " + doc.user_adjusted(0) + doc.alt_name(0) + "!"
Set rtitem = New NotesRichTextItem(emaildoc , "Doclink")
Call rtitem.AppendDocLink(doc, "")
Call emaildoc.Send(True)
doc.status = "Submitted"
doc.submit_flag = "done" 'field name for flag
Msgbox "Your request has been received and is being processed."
' Call doc.Save(True,True)
Call doc.Close
Else
Msgbox "This request was already recevied and is being processed."
End If
End Sub
Is there any error msgs it is giving? Try to debug the code using Lotus Script debugger and findout in which line it is skipping.
Are u getting msgbox: Your request has been received and is being processed." ?
and did u got the email?
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim ws As New notesuiworkspace
Dim emaildoc As NotesDocument
Dim Item As NotesItem
Dim rtitem As NotesRichTextItem
'Dim sNamesArr(1)As String
Dim sNamesArrB(1)As String
Set doc = ws.currentDocument.Documen
Set db = session.CurrentDatabase
On Error Resume Next
If doc.submit_flag(0) <> "done" Then
Call doc.Save(True,True)
Set emaildoc = db.CreateDocument
emaildoc.form = "vap_submit_tracer" 'Form name of Letter
emaildoc.sendto = doc.approver(0)
sNamesArrB(0) = doc.md_name(0)
sNamesArrB(1) = doc.om_name(0)
emaildoc.CopyTo = sNamesArrB
' emaildoc.BlindCopyTo = doc.bcc
emaildoc.Principal = "Field Technology"
emaildoc.Subject = "VAP Removal Request has been submitted for " + doc.user_adjusted(0) + doc.alt_name(0) + "!"
Set rtitem = New NotesRichTextItem(emaildoc
Call rtitem.AppendDocLink(doc, "")
Call emaildoc.Send(True)
doc.status = "Submitted"
doc.submit_flag = "done" 'field name for flag
Msgbox "Your request has been received and is being processed."
' Call doc.Save(True,True)
Call doc.Close
Else
Msgbox "This request was already recevied and is being processed."
End If
End Sub
Is there any error msgs it is giving? Try to debug the code using Lotus Script debugger and findout in which line it is skipping.
Are u getting msgbox: Your request has been received and is being processed." ?
and did u got the email?
hey and make that call doc.close to
call uidoc.close(true)
and add set uidoc=ws.currentdocument
and instead of call doc.save, use call uidoc.save(true)
call uidoc.close(true)
and add set uidoc=ws.currentdocument
and instead of call doc.save, use call uidoc.save(true)
ASKER
Thiink I almost have it, it gives the alert and saves the doc, it closes but it only does after it asks me if I want to save the doc then closes. I have tried adding Call uidoc.save(true) and (true,true) but it said Wrong Number of arguments.
use this code and test:
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim ws As New notesuiworkspace
Dim emaildoc As NotesDocument
Dim Item As NotesItem
Dim rtitem As NotesRichTextItem
'Dim sNamesArr(1)As String
Dim sNamesArrB(1)As String
set uidoc=ws.currentDocument
Set doc = ws.currentDocument.Documen t
Set db = session.CurrentDatabase
On Error Resume Next
If doc.submit_flag(0) <> "done" Then
Call doc.Save(True,True) 'Saving the Current document.
Set emaildoc = db.CreateDocument
emaildoc.form = "vap_submit_tracer" 'Form name of Letter
emaildoc.sendto = doc.approver(0)
sNamesArrB(0) = doc.md_name(0)
sNamesArrB(1) = doc.om_name(0)
emaildoc.CopyTo = sNamesArrB
' emaildoc.BlindCopyTo = doc.bcc
emaildoc.Principal = "Field Technology"
emaildoc.Subject = "VAP Removal Request has been submitted for " + doc.user_adjusted(0) + doc.alt_name(0) + "!"
Set rtitem = New NotesRichTextItem(emaildoc , "Doclink")
Call rtitem.AppendDocLink(doc, "")
Call emaildoc.Send(True)
doc.status = "Submitted"
doc.submit_flag = "done" 'field name for flag
Msgbox "Your request has been received and is being processed."
Call doc.Save(True,True)
Call doc.Close
Else
Msgbox "This request was already recevied and is being processed."
End If
End Sub
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim ws As New notesuiworkspace
Dim emaildoc As NotesDocument
Dim Item As NotesItem
Dim rtitem As NotesRichTextItem
'Dim sNamesArr(1)As String
Dim sNamesArrB(1)As String
set uidoc=ws.currentDocument
Set doc = ws.currentDocument.Documen
Set db = session.CurrentDatabase
On Error Resume Next
If doc.submit_flag(0) <> "done" Then
Call doc.Save(True,True) 'Saving the Current document.
Set emaildoc = db.CreateDocument
emaildoc.form = "vap_submit_tracer" 'Form name of Letter
emaildoc.sendto = doc.approver(0)
sNamesArrB(0) = doc.md_name(0)
sNamesArrB(1) = doc.om_name(0)
emaildoc.CopyTo = sNamesArrB
' emaildoc.BlindCopyTo = doc.bcc
emaildoc.Principal = "Field Technology"
emaildoc.Subject = "VAP Removal Request has been submitted for " + doc.user_adjusted(0) + doc.alt_name(0) + "!"
Set rtitem = New NotesRichTextItem(emaildoc
Call rtitem.AppendDocLink(doc, "")
Call emaildoc.Send(True)
doc.status = "Submitted"
doc.submit_flag = "done" 'field name for flag
Msgbox "Your request has been received and is being processed."
Call doc.Save(True,True)
Call doc.Close
Else
Msgbox "This request was already recevied and is being processed."
End If
End Sub
ASKER
I ran it through debugger and it hits all the steps and give the proper alert, it does not close the window though and when I escape it still asks me to save.
try with
call uidoc.close(true) instead of call doc.close
this should work
call uidoc.close(true) instead of call doc.close
this should work
ASKER
It now closes but it is still prompting me to save first.
then u should be having SaveOptions field?
or create one Saveoptions field and make the defualt value "0".
and in your code add doc.saveoptions="1"
and u can try with call doc.save(true,true) with uidoc for saving
and try doc and uidoc for closing.. u can play with them and u can know easily.
and is it in Std application or mail database?
if it is in Mail db, then u may get into problem as there are some problems validating..
or create one Saveoptions field and make the defualt value "0".
and in your code add doc.saveoptions="1"
and u can try with call doc.save(true,true) with uidoc for saving
and try doc and uidoc for closing.. u can play with them and u can know easily.
and is it in Std application or mail database?
if it is in Mail db, then u may get into problem as there are some problems validating..
ASKER
I have a Saveoptions field but it is set to 1
I will play around with that and the doc.uidoc issues.
THis is a std db
I will play around with that and the doc.uidoc issues.
THis is a std db
ASKER
Still trying to figure this one out, here is the end of the latest attempt. It is closing without prompting but I am getting an "Cannot locate default form" error.
emaildoc.Principal = "Field Technology"
emaildoc.Subject = "VAP Removal Request has been submitted for " + doc.user_adjusted(0) + doc.alt_name(0) + "!"
Set rtitem = New NotesRichTextItem(emaildoc , "Doclink")
Call rtitem.AppendDocLink(doc, "")
Call emaildoc.Send(True)
doc.status = "Submitted"
doc.submit_flag = "done" 'field name for flag
Msgbox "Your request has been received and is being processed."
Call doc.save(True,False)
doc.saveoptions = "0"
Call uidoc.close(True)
Else
Msgbox "This request was already recevied and is being processed."
End If
End Sub
emaildoc.Principal = "Field Technology"
emaildoc.Subject = "VAP Removal Request has been submitted for " + doc.user_adjusted(0) + doc.alt_name(0) + "!"
Set rtitem = New NotesRichTextItem(emaildoc
Call rtitem.AppendDocLink(doc, "")
Call emaildoc.Send(True)
doc.status = "Submitted"
doc.submit_flag = "done" 'field name for flag
Msgbox "Your request has been received and is being processed."
Call doc.save(True,False)
doc.saveoptions = "0"
Call uidoc.close(True)
Else
Msgbox "This request was already recevied and is being processed."
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I copied your script exactly and it does not ask me to save, but it does not save the doc at all. There is nothing in the view after it closes. I have reopened and refreshed.
Joe
Joe
Since the Saveoptions field u have is set to "0".. make it to "1".
or remove that Saveoptions field and test.
or remove that Saveoptions field and test.
ASKER
Thanks so much for helping with this one.
no problem.. and thanks for the points..
And I apologise for dragging this so far... I should have tested before...blindly I gave solutions...no time to test. looks like I am over confident..
And I apologise for dragging this so far... I should have tested before...blindly I gave solutions...no time to test. looks like I am over confident..
ASKER
Hey no problem, it all worked out.