Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next
Subject: Lotus Script not working
Feedback Type: Problem
Product Area: Notes Client
Technical Area: Customization
Platform: Windows
Release: 8.5.3
Reproducible: Always

Hi

I am trying to create a button in Notes to remove an old recent contact using the following LotusScript which I copied and pasted in, but it is not working, I keep getting back "Formula Error - An operator or semicolon was exepected but none was encountered: "Click"

I am adding the following script by "Add Action - @FormulaFunction" - pasting it in here.

Script

Sub Click(Source As Button)
Dim db As New NotesDatabase( "", "names.nsf" )
Dim view As NotesView
Dim doc1 As NotesDocument
Dim doc2 As NotesDocument
Dim targ As String 'Email address to search for
Dim add As String 'Contact email address
Dim nam As String 'Contact full name
Dim resp As Integer 'User response to prompt
Dim cnt1 As Integer 'Counter for matches
Dim cnt2 As Integer 'Counter for deletions

'Add the email address to search on here:
targ = "CN=username/OU=division/O=company"

cnt1 = 0
cnt2 = 0

Set view = db.GetView( "RecentCollaborators" )

Set doc1 = view.GetFirstDocument
Messagebox "This will scan your Recent Contacts list for addresses that are no longer valid.",, "Begin"

While Not(doc1 Is Nothing)

'Selects the value of the MailAddress field of the contact document to compare with email address
'This line can be modified to compare other fields in the document with the search criteria
add = doc1.GetItemValue("MailAddress")(0)

If add = targ Then
cnt1 = cnt1 + 1
nam = doc1.GetItemValue("FullName")(0)

'If match found in Recent Contacts, ask user if they want to delete the entry
resp = Messagebox("Found entry for " & nam & " in your Recent Contacts list with the wrong email address. Delete this entry?", 4 + 32 + 256, "Delete?")
Set doc2 = view.GetNextDocument(doc1)
If resp = 6 Then

'Error if user has the contact document open
If doc1.IsUIDocOpen Then
Messagebox "The entry for " & nam & " is open in your Recent Contacts list. Please close the entry and try the operation again.", 16, "Error!"
Else
doc1.RemovePermanently(True)
cnt2 = cnt2 + 1
Messagebox "The entry for " & nam & " was deleted.", 48, "Deleted!"
End If
Else
Messagebox "The entry for " & nam & " was not deleted.", 48, "Not Deleted!"
End If
Set doc1 = doc2
Else
Set doc1 = view.GetNextDocument(doc1)
End If
Wend

If cnt1 = 0 Then
Messagebox "Scan completed. No matches found.",, "Completed"
Else
Messagebox "Scan completed. " & cnt1 & " matches found, " & cnt2 & " contacts deleted.",, "Completed"
End If
End Sub

I am new to this and wnated to try it to see if it was possible.

Thanks in advance


Feedback number WEBB9F8LEX created by ~Vanessa Quetaveroopsi on 01/10/2014

Status: Open
Comments:

Lotus Script not working (~Vanessa Quetav... 10.Jan.14)
. . Because you pasted script into form... (~Fritz Ekfoober... 10.Jan.14)
. . LotusScript, not @Function (~Martha Lopjipy... 10.Jan.14)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS