Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Creating a scheduled Agent !!!

Posted on 2003-11-03
9
Medium Priority
?
254 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

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…
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

610 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