Skip to main content
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 4 and 5 Forum

Notes/Domino 4 and 5 Forum

developerWorks

  

Sign in to participate PreviousPrevious NextNext

Scheduled Agent to Change a Field & Send Email
Louise Owen 3.Feb.10 04:37 PM a Web browser
Domino Designer -- Agents 5.0.11 Windows XP

Hi,

I am trying to write an Agent to run on a specific view (which identifies documents of a certain age). I need it to change a field (status) from Pending to Open and also send an email to the named person on the document who created it (also containd in a field named CoOrdinator).

I setup an Agent as follows but it doesn't seem to work, any suggestions would be most gratefully received as i'm hitting my head against a brick wall right now!

Which doc should agent act on = All docs in view

(Options)

blank

(Declarations)

Dim session As notessession
Dim db As NotesDatabase
Dim doc As notesdocument

(Initialize)

Sub Initialize
Set session = New notessession
Set db = session.CurrentDatabase
Set view = db.GetView("testlou")
Set doc = view.GetFirstDocument

If Not (doc Is Nothing) Then
Call TestEmail
End If
End Sub

(TestEmail)

Sub TestEmail

Dim DocMail As notesdocument
Dim RtBody As notesrichtextitem
Dim mydb As notesdatabase
Set mydb = sess.currentdatabase

DocMail.Status ="Open"

'email
Set docMail=mydb.CreateDocument
Set RTBody=docMail.CreateRichTextItem("Body")
docMail.subject="CSST Database Request - " & DocA.RefNo(0) & " "& DocA.CaseType(0) & " - "& DocA.ClientLists(0) &" - Request Moved OUT of Pending"
docMail.SendTo= docA.CoOrdinator

'email content
Call RtBody.AppendText( "Dear " & docA.CoOrdinator (0))
Call RtBody.AddNewLine( 2 )
Call RtBody.AppendText( DocA.RefNo(0) & " \" & docA.Reason(0) & "\" & " "&"Submitted on the " & DocA.SubmitTime(0))
Call RtBody.AddNewLine( 2 )
Call RtBody.AppendText( "The above request has been moved out of Pending as it has been there for over 21 days, please action as soon as possible. " )
Call RtBody.AddNewLine( 2 )
Call RtBody.AppendText("To view and action the request please access the link below." _
& " click on the following document link -----> ")

Call RtBody.Appenddoclink(DocA, "Link to request - " &DocA.RefNo(0))
Call RtBody.AddNewLine( 2 )
docMail.send(False)

End Sub

Many Thanks,
Louise




Scheduled Agent to Change a Field &... (Louise Owen 3.Feb.10)
. . RE: Scheduled Agent to Change a Fie... (Chris Toohey 3.Feb.10)
. . RE: Scheduled Agent to Change a Fie... (Chris Chisholm 3.Feb.10)






  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

  Lotus Support
Lotus Support
Product support pages index
Search knowledge base (Technotes)
Search support downloads
Lotus Support RSS

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
Notes/Domino 4 and 5
IBM Connections
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
IBM SmartCloud Meetings
IBM Web Content Manager
Lotus Domino Document Manager
Lotus e-learning
Lotus Enterprise Integration
Lotus Expeditor
Lotus Protector
Lotus Quickr
Lotus SmartSuite
Lotus Symphony
Lotus Symphony Developer Toolkit Support
Lotus Workflow