We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Daily or weekly Email

kali958 asked
Medium Priority
Last Modified: 2013-12-18
I have an attendance database that I would like to send a weekly or daily email to mgmt/supervisors to tell them who is out of the office and maybe why.

The reason for the email is the traveilng mgmt and supervisor have blackberry's that have email access but not database access so they would like to know who is out and why while they are on the road.

I have an associate profile doc in the database that tells who each associates supervisor is. I have a view created that is sorted by Date and then employee Name, sup Name, type of time off, and duration. Where i am stuck is how to generate the email to send to the supervisors.

Any help would be much appreciated!!!!
Watch Question

Sjef BosmanGroupware Consultant

Why not hourly?? Paranoia kicking in?

Okay, here's a comparable solution:



Well with the way it is going, I am surpised it is not hourly :)

I get how to set the lotusscript up for the document, where i am a little lost is that i have a view set up "Sup_Email" The first column is Ascending/Categorized by Date of day off and then the next column is the Supervisor and then column 3 is the employee Name.  The part I am lost on how to do is how do I write it so that the scheduled agent will go out and find todays date, then put the supervisor name as the send to and put the empolyee name in the body.

I am not sure how to insert the data from the view. I can do a @DbLookup in formula language but I have not found how to say it in LS. Basically I want it to just go out and say, okay today is 2/16 and the supervisor is Tom Jones and Carol Smith is out, send him a email to just say that.  

I would ideally like it to be a weekly email but I am not willing to go there right now.

I have only written simple emails in LS that are based on a click. I have an example I am trying to tweak:
Sub Click(Source As Button)
	Dim s As NotesSession
	Dim db As NotesDatabase
	Dim ws As NotesUIWorkspace
	Dim uidoc As NotesUIDocument
	Dim doc As NotesDocument
	Dim edoc As NotesDocument
	Dim rtitem As NotesRichTextItem
	Dim Approval As Integer
	Set s = New NotesSession
	Set db = s.CurrentDatabase
	Set ws = New NotesUIWorkspace
	Set uidoc = ws.CurrentDocument
	Set edoc = New NotesDocument(db)
	Set rtitem = New NotesRichTextItem(edoc, "Body")
	Set doc = uidoc.Document
	'Set uidoc = ws.EditDocument( True )
	uidoc.EditMode = True
	edoc.SendTo = doc.Supervisor(0)
	edoc.Subject = "Associates Out of Office"
	Call rtitem.AppendText("Here is a list of Associate Out of office.")
	Call rtitem.AddNewline(2)
	Call rtitem.AppendText(" ")
	Call rtitem.AddNewline(2)
	Call rtitem.AppendText(" ")
	Call edoc.Send(False)
End Sub

Open in new window

Groupware Consultant
I suppose the view is not ideal for your agent. Far more suitable seems a view ordered by supervisor, then date off, then employee, or the latter two reversed. That way, you can prepare a mail per supervisor.

Walking through the mail should be easy. Have a look in the Designer Help database, in the examples of the NotesViewNavigator and NotesViewEntry methods. They are exactly what you need.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


Okay - I will change the view to be the Supervisor in the first column, Ascending and Catorgized, and then put the date column second and the employeename third.

I will research the NotesViewNavigator and NotesViewEntry method - Thank you. Do I also need to continue w/ researching the GetDocumentByKey?  That is where I seem to be a little lost.

Just to make sure I understand, by changing the view I can have the code then go look at the supervisor name, and if the "Today's" date is in the 2nd column it can then email the supervisor with the employee's name?  I am a bit concerned that this will send an email for each individual associate (so if the sup had two people out, they would get two emails) but then again they asked for a email notification.

I will see how tomorrow goes and let you know.
Sjef BosmanGroupware Consultant

General idea:

 open the view
 do until eof(view)
      read one line
      if this line contains a new supervisor then
            send assembled mail
            clear mail
      if there's no mail-document yet then
            create mail-document
      put info in mail-document
if the current mail-document is not sent
      send assembled mail


The view right now contains all the time off requests in the database, would it be better if I run the agent daily to then set a status on the form to say "Notification Sent" or it is more coding to have it look at today's date and then send the email?  I was thinking that the key would be the date but I can also change the view to only display today's people that are out of the office and then send the email?
Sjef BosmanGroupware Consultant

Normally, my scheduled agents always run hourly. If not all code should be executed hourly, I make my own scheduler and logging in a profile document. For instance, I need some code to run nightly, but only once; I put some code in the agent like
      If the daily routine didn't run today Then
            Call daily_routine
            Call update profile document
      End If

A similar thing could be done for your weekly stuff.

The code I add is to make sure the routine isn't executed twice on the same day, e.g. example when an administrator decides to resign all agents or so. I dislike updating documents for no good reason, but if it helps by all means add it. If you need an indicator, you can always use a hidden folder to put your documents in. And if a field should be set in all documents in that folder, you can use StampAll()


sjef - I am still working on this issue but a urgent update has come thru that I have to process before i can get back to this issue. Thanks for pointing me in the right direction thou. I will close this question for now and if I need further help I will get something out here.
Thanks for all your help!
Sjef BosmanGroupware Consultant

You're welcome!!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.