Problems with saving a sent e-mail after customizing the Send button in the mail template

Tags:
Lotus Domino
LotusScript
I have the requirement to go through each sendee of a mail (whether it be a group or an individual) and count how many people are going to receive the e-mail. If the total number is greater than 50, I need to prompt the user to agreeing that they meant to send it to that many people. I get the code to count and to prompt, as well as to send the e-mail. My problem is that it will not save the e-mail if the user either chooses to save it (if their preference is to always prompt on send) or save it automatically (if their preference is to always keep a copy). I have checked to make sure the saveoptions flag is set to "1" (and it is), so I am at a loss. Below is my code. Anyone see the issue? OPTIONS Use "CoreEmailClasses" DECLARATIONS Dim prompt_title As String Dim prompt_message As String Dim view As NotesView Dim nab_db As NotesDatabase Dim nab_view As NotesView Dim nab_doc As NotesDocument Dim counter As Integer Sub Click(Source As Button) Dim workspace As New NotesUIWorkspace Dim uidoc As NotesUIDocument Dim session As New NotesSession Dim totalList() As String 'array of all the entries in the to, cc, and bcc fields Dim totalListCounter As Integer Dim doc As NotesDocument Dim db As NotesDatabase Set uidoc = workspace.CurrentDocument 'set the message box's title and message prompt prompt_title = "Send to Large Audience?" prompt_message = "Please be advised, you are sending this email to a large audience. Continue?" counter = 0 Set db = session.CurrentDatabase Set doc = uidoc.Document totalListCounter = -1 'Gather all of the entries in the to field into the TotalList array new_counter = -1 If doc.GetItemValue("EnterSendTo")(0) <> "" Then Forall i In doc.EnterSendTo totalListCounter = totalListCounter + 1 Redim Preserve totalList(totalListCounter) As String totalList(totalListCounter) = i End Forall End If 'Gather all of the entries in the cc field into the TotalList array If doc.GetItemValue("EnterCopyTo")(0) <> "" Then Forall i In doc.EnterCopyTo totalListCounter = totalListCounter + 1 Redim Preserve totalList(totalListCounter) As String totalList(totalListCounter) = i End Forall End If 'Gather all of the entries in the bcc field into the TotalList array If doc.GetItemValue("EnterBlindCopyTo")(0) <> "" Then Forall i In doc.EnterBlindCopyTo totalListCounter = totalListCounter + 1 Redim Preserve totalList(totalListCounter) As String totalList(totalListCounter) = i End Forall End If 'Get a handle onto the nab Set nab_db = New NotesDatabase(db.Server, "names.nsf") Set nab_view = nab_db.GetView("($VIMGroups)") 'call the function that will count the number of users the email will be going to temp = resolveGroups(TotalList) 'if the number returned > 50, ask if the user still wants to send the message If temp > 50 Then answer = workspace.Prompt(PROMPT_YESNO,prompt_title, prompt_message) 'If they still want to send the message, call the email core class to send the message and 'close the window If answer = 1 Then doc.ActionInProgress = MEMO_SEND Continue = True Call uidoc.FieldSetText("useApplet", "True") Call cMemoObject.QuerySave(Continue) If continue = True Then Call uidoc.Close End If End If 'if the total amount <= 50, call the email core class to send the message and 'close the window Else doc.ActionInProgress = MEMO_SEND Continue = True Call uidoc.FieldSetText("useApplet", "True") Call cMemoObject.QuerySave(Continue) If continue = True Then Call uidoc.Close End If End If End Sub Function ResolveGroups(groupnames As Variant) Dim session As New NotesSession Dim abdoc As NotesDocument Forall i In groupnames 'if the entry being evaluated is = to All, automatically set the return value to 51 '(higher than the max allowed to be sent without the message) If i = "All" Then ResolveGroups = 51 Exit Forall End If 'check in the nab to see if the current entry is a group. if it is, check each member 'entry to see if there is a group nested. if yes...recall the function. Each member 'found will be added to the counter Set can_name = session.CreateName(i) Set abdoc = nab_view.GetDocumentByKey(can_name.Common) If Not abdoc Is Nothing Then If abdoc.HasItem("members") Then group_names = abdoc.members Call resolveGroups(group_names) End If Else counter = counter + 1 'if at any point during the process the counter gets greater than 50, stop executing 'the function If counter > 50 Then Exit Forall End If End If End Forall 'send the total found back to the main process ResolveGroups = counter End Function

Answer Wiki

Thanks. We'll let you know when a new response is added.

First of all, try running the PostSave event as well.
The other thing is to look at is the Selection Formula for the ($Sent) view. Your Memo is probably being saved, and you’ll probably be able to find in the all documents view, it just not being recognised as a Sent memo.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following