Solved

Automated send of form

Posted on 2004-04-07
8
431 Views
Last Modified: 2013-12-18
Need some help creating an automated mailer based on date. I have the code below to send a basic @mailsend notice but I know it is possible in LS to do the same but have it send a custom form and not just a mailer. I have the code I have used in the past to manually send a form but I want this to go at x number of days out. I guess I want to merge these two methods.
Automated Mailsend
SendTo := "user";
CopyTo := "";
Subject := "Subject";
Remark := "remark";
today:= @Date(@Now);
start:= @Date(date_from);
daysleft:= (start - today)/(60 * 60 * 24);SELECT
@If (daysleft = 30 & Form = "enb survey";@MailSend(sendTo;copyTo;"";Subject ; Remark  ; "" ; [IncludeDoclink]); "")

Manual Send of form
Sub Click(Source As Button)
      Dim workspace As New NotesUIWorkspace          
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim uidoc As NotesUIDocument
      Dim doc As NotesDocument
      Dim emaildoc As NotesDocument
      Dim Item As NotesItem
      Dim twoliner As String
      
      Set db = session.CurrentDatabase
      Set uidoc = workspace.CurrentDocument
      Set doc = uidoc.Document
      Set emaildoc = db.CreateDocument
      
      emaildoc.form = "enb T-15 Reminder"
      
      emaildoc.sendto = doc.entered_by(0)
            
      emaildoc.Subject = "Second Notice - Important Request to complete eNewBusiness Attendance Sheet"
      Call emaildoc.Send(True)
      
      twoLiner = |T-15 Reminder sent to participant. |
      Messagebox twoLiner, MB_OK, "Send Confirmation "
End Sub
0
Comment
Question by:jforget1
[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
  • 3
  • 3
  • 2
8 Comments
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 250 total points
ID: 10777741
Create agent which will be set to run on daily schedule.

Click on Add Search button and select by field and select Start field name and then select Is older than option and set a value of 30. Also add another search to look for specific form and a field flag (flag = "Done") that we will be introducing in the script to say that it has been processed by the agent

The script has to be modified a little bit to support this

     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim uidoc As NotesUIDocument
     Dim doc As NotesDocument
     Dim emaildoc As NotesDocument
     Dim Item As NotesItem
     Dim twoliner As String
     
     Set db = session.CurrentDatabase
set col = db.UnprocessedDocuments
     Set doc = col.GetFirstDocument
while not doc is nothing
     Set emaildoc = db.CreateDocument
     
     emaildoc.form = "enb T-15 Reminder"
     
     emaildoc.sendto = doc.entered_by(0)
         
     emaildoc.Subject = "Second Notice - Important Request to complete eNewBusiness Attendance Sheet"
     Call emaildoc.Send(True)
     
     twoLiner = |T-15 Reminder sent to participant. |
     Messagebox twoLiner, MB_OK, "Send Confirmation "
doc.Flag = "Done"
set doc = col.GetNextDocument(doc)
Wend


~Hemanth
0
 

Author Comment

by:jforget1
ID: 10777829
If I wanted the notice to only go on the 30 day mark would I change the search to "is in the next" and then the value of 30. Do I have to put "days" after 30 or does it know because the field in question is a date/time field.
0
 

Author Comment

by:jforget1
ID: 10778194
What I need to do is have this form go out when the date is 30 days in the future, but I only want it to go out once, not every day.
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 24

Expert Comment

by:HemanthaKumar
ID: 10778400
If it is future 30 days, then set the search on the date field to "Is after the next"

Also I am stamping the field called Flag = "Done" in the script add this to the search saying Flag , "Does Not Contain" , Done value

If you get into creating the agent all the above will make sense

0
 
LVL 19

Expert Comment

by:madheeswar
ID: 10780860
use the below code:
Sub Initialize
      Dim session As New notessession
      Dim db As notesdatabase
      Dim view As notesview
      Dim doc As notesdocument
      Dim dc As notesdocumentcollection
      Dim TodayDateTime As notesdatetime
      Dim tmpdate As NotesDateTime
      Dim sec As Long
      Dim maildoc As notesdocument
      Dim Body As NotesRichTextItem
      
      Set tmpdate = New NotesDateTime( "" )
      Set db=session.currentdatabase
      Set view=db.getview("overview") 'Change the view name.
      Set TodayDateTime = New NotesDateTime( "Today" )
      currentdate=TodayDateTime.lsLocalTime
      
       Set doc = view.getfirstdocument
      
      
      While Not doc Is Nothing
 'Get values from columns
            tmpname=doc.entered_by(0) 'this holds the Send to names.
            tmpdate.lslocaltime=doc.deadline_d(0) 'ur start date.
 'diffrence between two dates.
            sec = TodayDateTime.TimeDifference( tmpdate )
 'Msgbox sec
            balancedays=sec/86400
 'Msgbox balancedays
            
 'If the balance is more than one, send mail to interviewer.
            If (balancedays=30) Then ' if it is 30 days then.
 'Msgbox "yes"
                  Set maildoc = New NotesDocument( db )
                  maildoc.Form = "Memo"
                  maildoc.Subject = _
                  "Reminder: Please Review New Application"
                  Set Body=New NotesRichTextItem(maildoc,"Body")
                  message="Please Review the New Application"
                  Call Body.AppendText(message)
                  Call Body.AddNewLine(2)
                  message1="Please Click here to open the Link=========>>"
                  Call Body.AppendText(message1)
                  Call Body.AppendDocLink(doc,"Please Click this Link to open the Document")
                  Call maildoc.Send( True, tmpname )
            End If
            Set doc=view.getnextdocument(doc)
      Wend
      
End Sub
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 10780872
Another best example and faster is to create a view and have the selctin formula :
Select form="urForm name" & (@Adjust(startdate;0;0;30;0;0;0)=@Today)

this will collect all the documents which are 30days in future and u can use this view name in the above code. this will be fast and efficient.
0
 

Author Comment

by:jforget1
ID: 10782889
So madheeswar would I create a view with the selection formula  above and place that name where you have "overview" in the code. Do these have to work together or was the second comment an alternative solution? Also, in the selection formula wouldn't it be
-@Today and not =@Today, I just don't see where the evaluation is with the equal sign.  
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10783407
jforget, the selection formula that you are using is the search condition that is specified in the agent. It is easier than maintaining seperate views for this.

Also any view with time/date in selection formula or col will considerably slow down the performance of the db.
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

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…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
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…

623 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