?
Solved

Creating a scheduled Agent !!!

Posted on 2003-11-03
9
Medium Priority
?
253 Views
Last Modified: 2013-12-18
I need  to write an agent that loops through all the documents in a view (parent and child) and
sees if the "date_expired" field is with in 5 days of current date and then send out an email.
I would appreciate a basic skeleton code, something to start me off.
0
Comment
Question by:apparition
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9672225
Follow this steps

1. Create new agent and enable schedule
2. Click on Add Search button and select condition By Field
3. Select the field, and select option is in the last... and set it to 5 and Click OK button
4. Click on Add Action... button in Program pane and select Send Mail Message and set necessary parameters.

Save the agent and test

~Hemanth
0
 
LVL 14

Accepted Solution

by:
p_partha earned 300 total points
ID: 9672308
Are u looking for something like this:


      Dim session As New notessession
      Dim db As notesdatabase
      Set db = session.currentdatabase
      Set view = db.getview("<yourviewname>")
      Set doc  = view.getfirstdocument
      While Not doc Is Nothing
            dates = "10/27/2003" ' instead of this replace it iwth ur doc.<fieldname>
            Set t = New notesdatetime(dates)
            Set t1 = New notesdatetime(Today)
            If t1.TimeDifference(t)/86400 > 5 Then
                  Set maildoc = db.createdocument
                  maildoc.form = "memo"
                  maildoc.subject ="<somesubject>"
                  Set rtitem = New NotesRichTextItem ( maildoc, "Body" )
                  Call rtitem.AppendDocLink _
                  ( view, view.Name & " in " & db.Title )
                  maildoc.send False
            End If
            Set doc = view.getnextdocument(doc)
      Wend

change the view name and the dates value...

Partha
0
 
LVL 5

Author Comment

by:apparition
ID: 9672476
Partha

where do I specify the who I want to send the email to ?

0
Technology Partners: 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!

 
LVL 5

Author Comment

by:apparition
ID: 9672535
got it maildoc.Sendto
0
 
LVL 5

Author Comment

by:apparition
ID: 9672602
heres the code I'm using, but I'm getting a type mismatch error

Sub Initialize
      Dim session As New notessession
      Dim db As notesdatabase
      Set db = session.currentdatabase
      Set view = db.getview("Label Management")
      Set doc  = view.getfirstdocument
      While Not doc Is Nothing
            dates = doc.fldExpiry ' instead of this replace it iwth ur doc.<fieldname>
            Set t = New notesdatetime(dates)
            Set t1 = New notesdatetime(Today)
            If t1.TimeDifference(t)/86400 < 5 Then
                  Set maildoc = db.createdocument
                  maildoc.form = "memo"
                  maildoc.subject ="Expired Docs"
                  maildoc.SendTo ="Jon Doe"
                  Set rtitem = New NotesRichTextItem ( maildoc, "Body" )
                  Call rtitem.AppendDocLink _
                  ( view, view.Name & " in " & db.Title )
                  maildoc.send False
            End If
            Set doc = view.getnextdocument(doc)
      Wend
      End SubNavigator
End Sub

Also, I need to send a list of all the expired documents in one email
not a separate email for each expired doc.

Thanks for your help
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9674955
Hemantha's code wll work much better for you, and you can set an action to send newsetter, which will show the results as a document with a docLink to each found item.
0
 
LVL 5

Author Comment

by:apparition
ID: 9678804
I would ideally want  to get p_partha's code to work.

0
 
LVL 5

Author Comment

by:apparition
ID: 9678970
got it to work

heres the code I used

Dim session As notessession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim view As NotesView
Dim item As NotesItem
Set session = New NotesSession
      Set db = session.currentdatabase
      Set view = db.getview("Label Management")
      Set doc  = view.GetFirstDocument
      While Not doc Is Nothing
            Set item = doc.GetFirstItem( "fldExpiry" )
            Dim t As New NotesDateTime( item.Text)
            Dim t1 As New NotesDateTime("Today")
            If t1.TimeDifference(t)/86400 < 5 Then
                  Set maildoc = db.createdocument
                  maildoc.form = "memo"
                  maildoc.subject ="bla"
                  maildoc.SendTo ="Malik Arefin"
                  Set rtitem = New NotesRichTextItem ( maildoc, "Body" )
                  Call rtitem.AppendDocLink _
                  ( view, view.Name & " in " & db.Title )
                  maildoc.send False
            End If
            Set doc = view.getnextdocument(doc)
      Wend
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9679010
sorry,
I didn't get any mail that comments were added, so cudn't see the posts...

thx for the points

Partha
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
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 this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month15 days, 3 hours left to enroll

771 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