Sending mail with script (excluding attachment from form) - lotus-notes-programmer
This is a discussion on Sending mail with script (excluding attachment from form) - lotus-notes-programmer ; I would be gratefull for some advice with the following script I am using to send mail, it works as far as sending the mail but it includes an attachement from the form in the e mail (which I don't ...
![]() |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| |||
| |||
| using to send mail, it works as far as sending the mail but it includes an attachement from the form in the e mail (which I don't want). Any ideas ? Code; Public Function Submit Dim session As New NotesSession Dim ws As New NotesUIworkspace Dim Sender As String Dim Recipient As String Dim user As String Dim verifier As Variant Set uidoc=ws.CurrentDocument Set doc=uidoc.document User = session.CommonUserName Recipient = uidoc.FieldGetText("Recipient") Sender = uidoc.FieldGetText("txtname") uidoc.Save doc.Form = "Memo" doc.Subject = "Corrective Action Request" Set Body=New NotesRichTextItem(doc,"Body") Call Body.AppendDocLink(doc,"Please Click this Link to open the Document") Select Case doc.txtStatus(0) Case "Draft" Call Body.AppendText(" CAR for action Please follow this document link for details. Please accept or reject as appropriate ") Call doc.Send (False, uidoc.FieldGetText("txtRecipient")) uidoc.EditMode = True Call Body.AppendText("**********This is a copy of a recent CAR for your information*********") Call doc.Send(False, uidoc.FieldGetText("txtCopyTo")) Call uidoc.FieldSetText("txtstatus", "Submitted for Acceptance") uiDoc.Save Uidoc.Close Case "Accepted - In Progress" If user = Recipient Then Call Body.AppendText(" CAR for validation") Verifier = sbmtVerifiers(VerifierChosen) 'Call doc.Send (False, sbmtVerifiers(VerifierChosen)) 'Call uidoc.FieldSetText("Verifier",Verifier) Call doc.Send(False, Verifier) Call uidoc.FieldSetText("txtstatus", "Submitted for Validation") uiDoc.Save Uidoc.Close Else Messagebox("Only the recipient can send documents for validation!") Call uidoc.FieldSetText("saveoptions", "0") uidoc.Close(True) continue = False End If Case "Rejected" If User = Sender Then Call Body.AppendText(" CAR for action Please follow this document link for details. Once Accepted please agree a CAR date for completion ") Call doc.Send (False, uidoc.FieldGetText("txtRecipient")) uidoc.EditMode = True Call uidoc.FieldSetText("txtstatus", "Submitted for Acceptance") uiDoc.Save Messagebox("Thank you, the CAR has now been submitted") Uidoc.Close Else Messagebox("Only the originator can send documents for action!") Call uidoc.FieldSetText("saveoptions", "0") uidoc.Close(True) continue = False End If Case "Validation rejected" If User = Recipient Then Call Body.AppendText(" CAR for validation") Call doc.Send (False, sbmtVerifiers(VerifierChosen)) uidoc.EditMode = True Call uidoc.FieldSetText("txtstatus", "Submitted for Validation") uiDoc.Save Uidoc.Close Else Messagebox("Only the originator can send documents for validation!") Call uidoc.FieldSetText("saveoptions", "0") uidoc.Close(True) continue = False End If End Select End Function |
|
#2
| |||
| |||
|
what is doc ?? Wher do you set it? is it the same document opened in the workspace or another one you created? mj ha scritto: > I would be gratefull for some advice with the following script I am > using to send mail, it works as far as sending the mail but it > includes an attachement from the form in the e mail (which I don't > want). Any ideas ? > > Code; > Public Function Submit > Dim session As New NotesSession > Dim ws As New NotesUIworkspace > Dim Sender As String > Dim Recipient As String > Dim user As String > Dim verifier As Variant > > Set uidoc=ws.CurrentDocument > Set doc=uidoc.document > User = session.CommonUserName > Recipient = uidoc.FieldGetText("Recipient") > Sender = uidoc.FieldGetText("txtname") > > uidoc.Save > doc.Form = "Memo" > doc.Subject = "Corrective Action Request" > Set Body=New NotesRichTextItem(doc,"Body") > Call Body.AppendDocLink(doc,"Please Click this Link to open the > Document") > > Select Case doc.txtStatus(0) > > Case "Draft" > Call Body.AppendText(" CAR for action Please follow this document > link for details. Please accept or reject as appropriate ") > Call doc.Send (False, uidoc.FieldGetText("txtRecipient")) > uidoc.EditMode = True > Call Body.AppendText("**********This is a copy of a recent CAR for > your information*********") > Call doc.Send(False, uidoc.FieldGetText("txtCopyTo")) > Call uidoc.FieldSetText("txtstatus", "Submitted for Acceptance") > uiDoc.Save > Uidoc.Close > > Case "Accepted - In Progress" > > If user = Recipient Then > Call Body.AppendText(" CAR for validation") > Verifier = sbmtVerifiers(VerifierChosen) > 'Call doc.Send (False, sbmtVerifiers(VerifierChosen)) > 'Call uidoc.FieldSetText("Verifier",Verifier) > Call doc.Send(False, Verifier) > Call uidoc.FieldSetText("txtstatus", "Submitted for Validation") > > uiDoc.Save > Uidoc.Close > Else > Messagebox("Only the recipient can send documents for validation!") > Call uidoc.FieldSetText("saveoptions", "0") > uidoc.Close(True) > continue = False > End If > > Case "Rejected" > If User = Sender Then > Call Body.AppendText(" CAR for action Please follow this document > link for details. Once Accepted please agree a CAR date for completion > ") > Call doc.Send (False, uidoc.FieldGetText("txtRecipient")) > uidoc.EditMode = True > Call uidoc.FieldSetText("txtstatus", "Submitted for Acceptance") > uiDoc.Save > Messagebox("Thank you, the CAR has now been submitted") > Uidoc.Close > Else > Messagebox("Only the originator can send documents for action!") > Call uidoc.FieldSetText("saveoptions", "0") > uidoc.Close(True) > continue = False > End If > > Case "Validation rejected" > If User = Recipient Then > Call Body.AppendText(" CAR for validation") > > Call doc.Send (False, sbmtVerifiers(VerifierChosen)) > uidoc.EditMode = True > Call uidoc.FieldSetText("txtstatus", "Submitted for Validation") > uiDoc.Save > Uidoc.Close > Else > Messagebox("Only the originator can send documents for > validation!") > Call uidoc.FieldSetText("saveoptions", "0") > uidoc.Close(True) > continue = False > End If > End Select > End Function > |
|
#3
| |||
| |||
|
On 4 Nov, 22:49, ltony > what is doc ?? > Wher do you set it? > is it the same document opened in the workspace or another one you created? > > mj ha scritto: Hi Itony, Dim doc As notesdocument Dim uidoc As notesuidocument |
|
#4
| |||
| |||
|
On 5 Nov, 10:17, mj > On 4 Nov, 22:49, ltony > > > what is doc ?? > > Wher do you set it? > > is it the same document opened in the workspace or another one you created? > > > mj ha scritto: > > Hi Itony, > > Dim doc As notesdocument > Dim uidoc As notesuidocument Forgot to add the declaration and the script is set in the script library. I am sure it's something simple to do with the way I have declared and set the doc and uidoc, I am not used to notes script that much as my background is in vb.net. Thanks in advance |
|
#5
| |||
| |||
|
Just to clarify the problem, you want to send an email with a doclink to the original document. However, the email contains an attachment from the original document. If this is the case, the problem is that you are using the original document as the 'mail' document. What you need is to create a new 'temporary' document and use it to send... Dim session As New NotesSession Dim ws As New NotesUIworkspace Dim Sender As String Dim Recipient As String Dim user As String Dim verifier As Variant ' *** dim docMail as NotesDocument dim Body as NotesRichTextItem '*** Set uidoc=ws.CurrentDocument Set doc=uidoc.document User = session.CommonUserName Recipient = uidoc.FieldGetText("Recipient") Sender = uidoc.FieldGetText("txtname") uidoc.Save set docMail = new NotesDocument(doc.ParentDatabase) docMail.ReplaceItemValue "Form", "Memo" docMail.ReplaceItemValue "Subject", "Corrective Action Request" Set Body=New NotesRichTextItem(docMail,"Body") Call Body.AppendDocLink(doc,"Please Click this Link to open the Document") select case doc.GetItemValue("txStatus")(0) .... from now on, you use the docMail to send ... eg Call docMail.Send(False, Verifier) end select delete Body = nothing ' clean up delete docMail ' clean up - note: there is no need to save docMail as it is only temoprary for sending |
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| Display Modes | |
| |
All times are GMT -4. The time now is 02:27 AM.




Linear Mode