Solved

quickplace placebot

Posted on 2007-11-15
8
528 Views
Last Modified: 2013-12-18
I'm trying to create an email notification placebot which should run when a form is submited.
I've tried to adopt the code from a placebot which runs on the folder in which the document created by the form "Site Location" are placed. I struggling to figure out how to refer to the current document.

Thanks,
Duncan

Sub Initialize

	On Error Goto errorhandler

	Dim ws As New notesuiworkspace

	

	Dim ss As New NotesSession

	Dim db As NotesDatabase

	Dim view As NotesView

	Dim doc As NotesDocument

	Dim docMail As NotesDocument

	

	Set db=ss.GetDatabase("QKPL200/QUICKPLACE","QuickPlace/test_project/PageLibrary8525787R006D805F.nsf")

	

	

	'Set view=db.GetView("Locations")

	'Set doc=view.GetFirstDocument

	webname = Evaluate({@webdbname},doc)

	'Set doc=ss.

	Set doc=ws.CurrentDocument.Document

	'While Not doc Is Nothing

	Dim CountryEMEA As Variant

	CountryEMEA = doc.GetItemValue( "c_Country" )(0)

	

	

	Set docMail = db.CreateDocument()

	Set rtitemBody = New NotesRichTextItem(docMail, "Body")

	docMail.Form = "Memo"

	

	If  CountryEMEA(0)="Test" Then 

		docMail.Sendto="mail address 1"

	Elseif  CountryEMEA(0)="test1" Then 

		docMail.Sendto="mail address 2"

	End If

	Msgbox "sending mail"

	Print "sending mail"

	docMail.Copyto=""

	docMail.Subject="Subject text"

	Call rtitemBody.appendtext("----------------------------------------------------------")

	Call rtitemBody.addnewline(1)

	Call rtitemBody.appendtext("A Notification from Lotus QuickPlace")

	Call rtitemBody.addnewline(1)

	Call rtitemBody.appendtext("----------------------------------------------------------")	

	Call rtitemBody.addnewline(2)

	Call rtitemBody.appendtext("You can access this page either by clicking on the link below, or by copying and pasting it into your browser.")		

	Call rtitemBody.addnewline(2)

	Call rtitembody.AppendText("http://qpchaseweb.chase.com/"+Cstr(webname(0))+"/Locations/" + doc.UniversalID+"/?opendocument")	

	Call rtitemBody.addnewline(2)

	Call rtitemBody.appendtext("Regards,")

	Call rtitemBody.addnewline(1)

	Call rtitemBody.appendtext("Sender")

	Call rtitemBody.addnewline(2)

	Call rtitemBody.appendtext("----------------------------------------------------------")

	Call docMail.Send(False)

	

	

	

		'Set doc=view.GetNextDocument(doc)

'	Wend

	Exit Sub

errorhandler:

	Msgbox "Error occured in the place bot at line no. "&Erl()&" error is "&Error()

End Sub

Open in new window

0
Comment
Question by:dgoldie
  • 3
  • 3
  • 2
8 Comments
 
LVL 63

Expert Comment

by:SysExpert
ID: 20296141
Dim uiw As New notesuiworkspace

Dim uidoc As notesuidocument

Dim doc1 As notesdocument

Set uidoc=uiw.currentdocument  ' uidoc is the current doc via UI

Set doc1=uidoc.document  ' doc1 is the currently open document - Backend


I hope this helps !
0
 

Author Comment

by:dgoldie
ID: 20306519
Thanks for the response however I just realised I was going about this in totally the wrong way.
To create the notification I did'nt need to reference the current document, it was in fact the last document in the view I needed to reference ie. GetLastDocument



0
 
LVL 63

Expert Comment

by:SysExpert
ID: 20309892
Glad you reolved this !
0
 
LVL 31

Accepted Solution

by:
qwaletee earned 250 total points
ID: 20313210
Then you just need

Set view = db.getView(...)
Set doc = view.getLastDocument

By the way, NotesUiWorkspace and other NotesUI... classes do not work in placebots.  You need db.unprocessedDocument or session.documentContext, depending on how you are running.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:dgoldie
ID: 20313741
The getlastdocument option works for newly created documents, is there a way of identifying the most recently updated document in a view/ folder?
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 20314489
You need your view to sort by last modification date. You can build a custom view to do this.
0
 
LVL 63

Assisted Solution

by:SysExpert
SysExpert earned 250 total points
ID: 20317119
You would need a view tht is sorted by last modified date that you can access.


I hope this helps !
0
 

Author Closing Comment

by:dgoldie
ID: 31409484
Although I sort of answered my initial question, the combined contributions of qwaletee and SysExpert allowed me to gain access to a clearer understanding of the methods.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
LOtus Notes 6.5 low performance 13 36
Lotus Notes and VMWare require a double-click 22 1,352
Domino Server 2 72
Lotus Notes Calendar Help 6 98
For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now