Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Add Reminder to Calendar

Posted on 2001-06-05
11
Medium Priority
?
433 Views
Last Modified: 2013-12-18
I'm busy creatinf a workflow application.
I want to add a button to my form that will prompt the user to enter a date and time.
I then want to add a reminder to the users Calendar for the date and time that they entered.
I have a field on my form called Subject. I want this field to appear in the appointment Subject and Body.

Can you please give me the code to do this.

Thank you,
Robin
0
Comment
Question by:MossRobin
[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
  • 6
  • 5
11 Comments
 
LVL 4

Expert Comment

by:sloeber
ID: 6155606
Here's an example of how to do something like that
This button is on the STP Form, which creates a calendar entry into the person's mail)

Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document

DocUNID = doc.STP_DocUNID(0)
url = "http://server.com/crm/salesprocess.nsf/0/" + DocUNID + "?OpenDocument"
ReminderAccountName = doc.STP_AccountName(0)
ReminderStrategy = doc.STP_StrategyTitle(0)
ReminderWho = doc.STP_Who(0)
ReminderDate = doc.STP_Date(0)
RTime = doc.STP_Time(0)
If RTime = "" Then
ReminderTime = "9:00:00 AM"
Else
ReminderTime = RTime
End If
FullDate = Str(ReminderDate) + " " + Str(ReminderTime) + " " + "ZE8"
Dim DateTime As New NotesDateTime(FullDate)
Dim IsTime As Variant
IsTime = DateTime.LSLocalTime

Dim session As New NotesSession
Dim user As String
user = session.CommonUserName

Dim dbnab As NotesDatabase
Dim view As notesview
Dim docnab As NotesDocument
Set dbnab = New NotesDatabase( "Spider", "names.nsf" )
Set view = dbnab.GetView("People")
Set docnab = New notesdocument(dbnab)
Set docnab = view.getdocumentbykey(user)

If (docnab Is Nothing) Then
Print "No Matching Document"
Else
dbname = docnab.MailFile(0)
Set dbmailfile = New notesdatabase("Spider", dbname)
Set docnab = dbmailfile.CreateDocument
docnab.Form = "Appointment"
docnab.AppointmentType = "4"
docnab.Subject = ReminderStrategy + " - " + ReminderWho + " (" + ReminderAccountName + ")"
docnab.StartDate = IsTime
docnab.StartTime = IsTime
docnab.StartDateTime = IsTime
docnab.CalendarDateTime = IsTime
docnab.Principal = user
docnab.Body = "Please click on this link for more information : " + url
Call docnab.Save( True, True )
End If
End Sub


I hope that this help you
Greets,
Sloeber
0
 

Author Comment

by:MossRobin
ID: 6155673
Thanks, I'm testing it...
It doesn't make all that much sence to me.

Will come back as soon as I have a problem or am happy with it.

Regards,
Robin
0
 

Author Comment

by:MossRobin
ID: 6155764
OK I have a Problem !!!!!!!!!!!!!!!
I have included my code for the button.
I make an entry to the Calendar but it isn't a reminder...
If I goto Options Tab Notify me is NOT checked.
If I check it, a dialog box opens and ask me to enter minutes before the time the alarm must go off.
I need to enter this automatically too.

Please help again.
If possible please make mods to my code.

Thanks,
Robin

Sub Click(Source As Button)
     On Error Goto errhandle    
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim doc As NotesDocument
     Set db = New NotesDatabase ("RCBG01NT","mail\rmoss.nsf")
     Set doc = db.CreateDocument
     Dim workspace As New NotesUIWorkspace
     Dim uidoc As NotesUIDocument
     Dim IsTime As Variant
     IsTime = "05/06/2001 14:00:00 PM"
     Set uidoc = workspace.CurrentDocument
     Set doc2 = uidoc.Document
     doc.Form = "Appointment"
     doc.AppointmentType = "4"
     doc.Subject = "Modified Script"
     doc.StartDate = IsTime
     doc.StartTime = IsTime
     doc.StartDateTime = IsTime
     doc.CalendarDateTime = IsTime
     doc.Principal = "Robin Moss"
     doc.Body = "Please click on this link for more information : " + url
     Call doc.Save( True, True )
     Exit Sub
     
Errhandle:
     Msgbox "Line " & Erl
     
End Sub
0
Independent Software Vendors: 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 4

Expert Comment

by:sloeber
ID: 6155802
I must go away no for an appointment.
But you can add this to your code
doc.Alarms="1"
and may be it's also necessary to add
doc.$AlarmDisabled="1"
I didn't test it.
It is also possible that you must add an ~ before the $
doc.~$AlarmDisabled="1"

Greets,
Sloeber
0
 
LVL 4

Expert Comment

by:sloeber
ID: 6155828
i figured it out;
And this are the remarks.
The following fields should be set: $AlarmDescription, $AlarmTime, $Alarm and doc.Alarm (separate fields)
There are 2 more things that must be done before the alarm will trigger.
1. Check to see if the Reminder document has a field called $AlarmDisabled.
If doc.HasItem("$AlarmDisabled") Then
doc.RemoveItem("$AlarmDisabled")
End if
2. YOU MUST PUT THE REMINDER DOCUMENT IN THE ALARM FOLDER
after you've created and saved the entry:
Call doc.PutInFolder("$Alarms", True)
These things should trigger the alarm at the right times. Depending on how you've written your code you might need to play around with the code to get it to work properly.

I hope it helps.

Greets,
Sloeber
0
 

Author Comment

by:MossRobin
ID: 6156125
Hi, thanks for the help...
It still isn't working yet. Something I've noticed is that my reminder appears as a DRAFT. It is in my DRAFT view and it has a draft icon on a reminder icon in the All Docs view. This is even with the code at the end to move it to the $Alarm folder.

I think if I can just get it in the $Alarm folder it'll work. I've tried making the $Alarm folder vissible to see if I can see it there and I cannot. What I did was open my mail file in Designer and goto the folder design and click the refresh button to see what is in there. There are other entries but not the ones I'm creating...

If I open the reminder in my draft view and click save and close, it appears in the $Alarm view.

PLEASE HELP. I've increased the question to 600 points.
here is the code I'm currently using.

Thanks,
Robin

Sub Click(Source As Button)
     On Error Goto errhandle    
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim doc As NotesDocument
     Set db = New NotesDatabase ("RCBG01NT","mail\rmoss.nsf")
     Set doc = db.CreateDocument
     Dim workspace As New NotesUIWorkspace
     Dim uidoc As NotesUIDocument
     Dim IsTime As Variant
     IsTime = "05/06/2001 16:25:00 PM"
     Msgbox ("isdate = " + IsTime)
     Set uidoc = workspace.CurrentDocument
     Set doc2 = uidoc.Document
     Dim RefNo
     doc.Form = "Appointment"
     doc.AppointmentType = "4"
     doc.Subject = "Modified Script"
     doc.StartDate = IsTime
     doc.StartTime = IsTime
     doc.StartDateTime = IsTime
     doc.CalendarDateTime = IsTime
     doc.Principal = "Robin Moss"
     doc.Body = "Please click on this link for more information : " + url
     doc.~$Alarm = "1"
     doc.~$AlarmDisabled = "0"    
     doc.~$AlarmOffset = -10
     doc.~$AlarmTime = IsTime
     doc.~$AlarmDescription = "Occupational Hygiene Control"    
     doc.Alarms = "1"
     doc.Alarm = "1"
     
     If doc.HasItem("$AlarmDisabled") Then
          doc.RemoveItem("$AlarmDisabled")
     End If    
     Call doc.Save( True, True )
     
     Call doc.PutInFolder("($Alarms)", True)
     Exit Sub
     
Errhandle:
     Msgbox "Line " & Erl & Error
     
End Sub
0
 

Author Comment

by:MossRobin
ID: 6156146
Sloeber it wont let me increase the points to more that 300...
We'll make a plan and open another question and accept your comments. Once this is done.

Thanks for the help !!

Robin
0
 

Author Comment

by:MossRobin
ID: 6156193
Sloeber it wont let me increase the points to more that 300...
We'll make a plan and open another question and accept your comments. Once this is done.

Thanks for the help !!

Robin
0
 
LVL 4

Expert Comment

by:sloeber
ID: 6156723
I figure it out almost.
The problem is with your date/time value.
Now, is your document visible in the folder alarms and the view calendar.
But he dopn't let you see your document because your type of IsTime is wrong
Here's my code.
Tommorriw you'll have the correct solution
On Error Goto errhandle    
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim doc As NotesDocument
     Set db = New NotesDatabase ("servername","mail\test.nsf")
     Set doc = db.CreateDocument
     Dim IsTime As Variant
     IsTime = "05-06-2001 16:25:00"
     Dim RefNo
     doc.Form = "Appointment"
     doc.AppointmentType = "4"
     doc.Subject = "Modified Script"
     doc.StartDate = IsTime
     doc.StartTime = IsTime
     doc.StartDateTime = IsTime
     doc.CalendarDateTime = IsTime
     doc.Principal = "Robin Moss"
     doc.Body = "Please click on this link for more information : " 
     doc.~$Alarm = "1"
     doc.Excludefromview = "D"
     doc.~$AlarmOffset = -10
     doc.~$AlarmTime = IsTime
     doc.~$AlarmDescription = "Occupational Hygiene Control"    
     doc.Alarms = "1"
     doc.Duration = 1
     doc.OrgConfidential = "0"
     doc.BookFreeTime = "0"
     doc.~_ViewIcon = 10
     doc.OrgTable = "CO"
     If doc.HasItem("$AlarmDisabled") Then
          doc.RemoveItem("$AlarmDisabled")
     End If    
     Call doc.PutInFolder("$Alarms", True)
     
     Call doc.Save( True, True )
     
     Call doc.PutInFolder("$Alarms", True)
     
     Exit Sub
     
Errhandle:
     Msgbox "Line " & Erl & Error
     

greets,
sloeber
0
 
LVL 4

Accepted Solution

by:
sloeber earned 1200 total points
ID: 6156821
JOEPIIIIIIIIIIIIEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
It works, here's the final solution

Sub Initialize
On Error Goto errhandle    
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim doc As NotesDocument
     Set db = New NotesDatabase ("RCBG01NT","mail\rmoss.nsf")
     Set doc = db.CreateDocument
     Dim IsTime As New NotesDateTime( "05/06/2001 20:30" )
     Dim RefNo
     doc.Form = "Appointment"
     doc.AppointmentType = "4"
     doc.Subject = "Modified Script"
     Set doc.StartDate = IsTime
     Set doc.StartTime = IsTime
     Set doc.CalendarDateTime = IsTime
     Set doc.StartDateTime = IsTime
     doc.Principal = "Robin Moss"
     doc.Body = "Please click on this link for more information : " 
     doc.~$Alarm = "1"
     doc.Excludefromview = "D"
     doc.~$AlarmOffset = -10
     doc.~$AlarmTime = IsTime.LocalTime
     doc.~$AlarmDescription = "Occupational Hygiene Control"    
     doc.Alarms = "1"
     doc.Duration = 1
     doc.OrgConfidential = "0"
     doc.BookFreeTime = "0"
     doc.~_ViewIcon = 10
     If doc.HasItem("$AlarmDisabled") Then
          doc.RemoveItem("$AlarmDisabled")
     End If    
     Call doc.PutInFolder("$Alarms", True)
     
     Call doc.Save( True, True )
     
     Call doc.PutInFolder("$Alarms", True)
     
     Exit Sub
     
Errhandle:
     Msgbox "Line " & Erl & Error
     
End Sub

Greets,
Sloeber
0
 

Author Comment

by:MossRobin
ID: 6158606
Thanks Sloeber, your last proposal is 100%.
Thanks for the help.
Robin
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
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.

722 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