Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Reminder Agent

Posted on 2005-04-20
16
Medium Priority
?
553 Views
Last Modified: 2013-12-18
I want to use the below script to send out scheduled reminders but am not sure about the Sendto.  I want to grab a list of manager from the first column of a view called ManagerList. Can someone help?

Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim doc As NotesDocument
      Dim body As NotesRichTextItem
      
      Set db = session.CurrentDatabase
      Set doc = db.CreateDocument()
      doc.form = "Memo"
      doc.Sendto = ""
      doc.Subject = "Asset Reminder for Managers and Supervisors"
      Set body = doc.CreateRichTextItem("body")
     '  ....   Set the contents of the Body with the RichTextItem methods
      Call body.AppendText( "This a weekly scheduled reminder to collect any assets from Terminated Employess and to distribute any assets to New Employees.  Then, update the Users Profile document accordingly in the Asset Tracking Database" )
      Call doc.Send(False)
End Sub
0
Comment
Question by:schmad01
  • 8
  • 8
16 Comments
 
LVL 14

Expert Comment

by:p_partha
ID: 13827883
Somethign in this lines:


   Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Dim body As NotesRichTextItem

set view = db.getview("Managerlist")
set viewdoc = view.getfirstdocument
while not viewdoc is nothing
Set doc = db.CreateDocument()
    doc.form = "Memo"
    doc.Sendto = ""
    doc.Subject = "Asset Reminder for Managers and Supervisors"
    Set body = doc.CreateRichTextItem("body")
    '  ....   Set the contents of the Body with the RichTextItem methods
    Call body.AppendText( "This a weekly scheduled reminder to collect any assets from Terminated Employess and to distribute any assets to New Employees.  Then, update the Users Profile document accordingly in the Asset Tracking Database" )
doc.sendto = viewdoc.columnvalue(0)
    Call doc.Send(False)
set viewdoc = view.getnextdocument(viewdoc)
wend
0
 

Author Comment

by:schmad01
ID: 13828167
Not working. Getting

For the DIM session as New NotesSession I'm getting:  Illegal executable code in Declarations.

I took that out for the hell of it and test ran the agent, then got:

Object variable not set
0
 
LVL 14

Expert Comment

by:p_partha
ID: 13828177
Did you put the code inside the initialize

partha
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:schmad01
ID: 13828187
Yes.
0
 
LVL 14

Expert Comment

by:p_partha
ID: 13828200
remove all teh code from declarations and paste my code in initialize

partha
0
 

Author Comment

by:schmad01
ID: 13828241
Ok, I did what you said, then tried to save and got:  Illegal executable code at the module level
0
 
LVL 14

Expert Comment

by:p_partha
ID: 13828257
can you create  a new agent and write this code in initialize. Just paste this in between initialize not anywhere else

partha
0
 

Author Comment

by:schmad01
ID: 13828322
Ok, now errors on saving. When I test ran it, Object variable not set popped up.  Put in debugging mode and it got the error at this line:

Set view = db.getview("Managerlist")
0
 
LVL 14

Expert Comment

by:p_partha
ID: 13828386
above that line
jsut give htis:

set db = session.currentdatabase

Partha
0
 

Author Comment

by:schmad01
ID: 13828480
That got rid of that error. Now getting a popup saying:

Notes error: No names found to send mail to.

The view name is correct. Does the column have to be sorted?
0
 

Author Comment

by:schmad01
ID: 13828488
It is sorted Ascending. Not categorized.  FYI
0
 
LVL 14

Expert Comment

by:p_partha
ID: 13828502
can u tell me what is there in first column (i mean the fieldname)

Thanks
partha
0
 

Author Comment

by:schmad01
ID: 13828529
Column formula is @Name([CN];rename)
0
 
LVL 14

Accepted Solution

by:
p_partha earned 500 total points
ID: 13828545
Try this:

Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Dim body As NotesRichTextItem

set view = db.getview("Managerlist")
set viewdoc = view.getfirstdocument
while not viewdoc is nothing
Set doc = db.CreateDocument()
    doc.form = "Memo"
    doc.Sendto = ""
    doc.Subject = "Asset Reminder for Managers and Supervisors"
    Set body = doc.CreateRichTextItem("body")
    '  ....   Set the contents of the Body with the RichTextItem methods
    Call body.AppendText( "This a weekly scheduled reminder to collect any assets from Terminated Employess and to distribute any assets to New Employees.  Then, update the Users Profile document accordingly in the Asset Tracking Database" )
doc.sendto = viewdoc.rename
    Call doc.Send(False)
set viewdoc = view.getnextdocument(viewdoc)
wend
0
 

Author Comment

by:schmad01
ID: 13828621
That's it!  Thanks alot, Partha!
0
 
LVL 14

Expert Comment

by:p_partha
ID: 13828633
Thanks
Also make sure once the mail is sent the document is out of the view...

- Partha
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month21 days, 5 hours left to enroll

810 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