Solved

Creating a scheduled Agent !!!

Posted on 2003-11-03
9
247 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
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 75 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
 
LVL 5

Author Comment

by:apparition
ID: 9672535
got it maildoc.Sendto
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
authenticating IIS users via a Lotus Domino Server 5 167
Lotus notes 3 294
Username format for Domino LDAP 3 65
IBM Lotus notes 9 81
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

23 Experts available now in Live!

Get 1:1 Help Now