Hi Eveyone,
I am having problems with this LS code below. What I need it to do is the following:
A user displays a document in the db (notes client), then hits the Opt-Out button, this button should do the following in LS.
It needs to save and close (if it can) the existing document they are in (with the opt-out button), then open a new document using a different form. Then this new document is saved and closed and emailed.
I’d really appreciate some help, and thanks as usual in advance to everyone who might resond.
Here is my code:
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Dim newdoc As NotesDocument
Dim emaildoc As NotesDocument
Dim emailbody As NotesRichTextItem
Set uidoc = ws.currentdocument
Set doc = uidoc.document
Set db = doc.ParentDatabase
Set newdoc = New NotesDocument(db)
Dim boxType As Long, answer As Integer
boxType& = 3+ 32
mtexttodisplay = "Continue to Submit Opt-Out Form"
Messagebox "I have opted out of the company car scheme and accept company car allowance in lieu of a company vehicle. I confirm that I am never required to drive on business.", boxType& , mtexttodisplay
uidoc.editMode = True
Call uidoc.FieldSetText("OptOutToggle", "No")
Call uidoc.FieldSetText("RetToggle", "No")
Call uidoc.FieldSetText("ResToggle", "Yes")
Call uidoc.FieldSetText("Status", "Retired")
Call uidoc.Save
Call uidoc.Close
newdoc.form = "OptOut"
newdoc.OnshoreOffshore = doc.OnshoreOffshore(0)
newdoc.AuthorisedName = doc.AuthorisedName(0)
Call newdoc.FieldSetText("AppToggle", "Yes")
Call newdoc.FieldSetText("RejToggle", "Yes")
Call newdoc.FieldSetText("Status", "Pending Approval")
Call newdoc.FieldSetText("NewDoc", "No")
Set newuidoc = ws.EditDocument(True, newdoc)
Set emaildoc=New NotesDocument(db)
Set emailbody =New NotesRichTextItem(emaildoc,"Body")
emaildoc.Form = "Memo"
emaildoc.Subject = "Business Drivers DB - Opt-Out Approval is required for " & uidoc.FieldGetText("Name")
emaildoc.SendTo=newdoc.AuthorisedName
emaildoc.CopyTo=newdoc.Facilities
Call emailbody.AddNewLine(2)
Call emailbody.AppendText("This Opt-Out form for " & uidoc.FieldGetText("Name") & " has been sent to you to approve.")
Call emailbody.AddNewLine(2)
Call emailbody.AppendText("Please follow the link below, Thank You...")
Call emailbody.AddNewLine(2)
Call emailbody.AppendText("Link to task -->>")
Call emailbody.AppendDocLink(newdoc,db.Title)
flag=emaildoc.ComputeWithForm(False,False)
Call emaildoc.Send(False)
Call newdoc.Save( False, False )
Call newdoc.close
End Sub
I am getting a Illegal use of PROPERTY box on the line:
Call newdoc.FieldSetText(“AppToggle”, “Yes”)
Before I added setting the fields on the new document and the email section, it was working but did not close the original document with the button, but it was working as in the new form was displayed and saved etc…
Thanks again.
Hayley.