357 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
jQuery – A flexible way to show/hide sections
Wed, Aug 27th 2014 57
IBM ConnectED 2015 – registration open
Tue, Aug 19th 2014 106
I am a victim of identity theft
Tue, Aug 12th 2014 348
The joy of programming
Wed, Aug 6th 2014 251
Lotus Notes at my work threatened by Microsoft bug
Tue, Aug 5th 2014 434
ConnectED 2015 – Smaller and shorter but more technical
Thu, Jul 24th 2014 310
Recover lost SSL keyring password
Thu, Jul 24th 2014 184
Top 10
Pool party or no pool party, that is the question – or is it?
Mon, Jan 13th 2014 1483
Export Notes view to Excel – with multi-value fields
Fri, Apr 5th 2013 779
Export from Notes to Excel – 3 different ways
Wed, Nov 14th 2012 679
In memory of Tim Tripcony
Mon, May 12th 2014 620
Free Tool: Analyze ACL in Notes Application/Database
Tue, Nov 15th 2011 564
Code snippet – jQuery
Sat, Mar 15th 2014 561
Things we don’t want to think about
Thu, May 15th 2014 506
Create and update Calendar reminders from Notes document
Thu, Aug 11th 2011 504
IBM Connect becomes IBM ConnectED in 2015
Wed, Jul 23rd 2014 467
jQuery – An Overview
Fri, Jul 19th 2013 455


Create and update Calendar reminders from Notes document
Karl-Henry Martinsson    

At work I was asked yesterday if I could give the users a button to set reminders for meetings/actions directly from a document in one of our Notes applications. So I created a simple solution where I added two action buttons and a field to the form from which the calendar entry (reminder) would be created.

I wanted to share this code. It is nothing complicated, and the main functionality consists of some code Palmi Lord posted in LDD last year.

The new field on the form is called 'CalendarUNID' and will contain the Universal ID of the calendar entry. If the field is blank, I will display the 'Add to Calendar' button, if it contains a value I will display the button 'Update Calendar Entry' instead. This field is also used by the update function to get to the original calendar entry. Note that the reminder is created in the current user's calendar, and can only be successfully updated by the same user.
The date field used is named 'InspedtionDate', and I set the time to 8am. In the reminder I am also putting the address of the insured (the application is used by an insurance company) in the location field, and the insured/account name and policy number in the subject field.

 

'Add to Calendar' button

Hide-when formula:

CalendarUNID!="" | InspectionDate=""

Lotusscript Code:

Sub Click(Source As Button)
   Dim ws As New NotesUIWorkspace
   Dim uidoc As NotesUIDocument
   Dim calentry As NotesDocument
   Dim appdate As NotesDateTime
   Dim location As String
   Dim subject As String
   Dim calunid As String
 
   Set uidoc = ws.CurrentDocument
   Set appdate = New NotesDateTime(uidoc.FieldGetText("InspectionDate") _
   & " 08:00:00 AM")
   ' Get physical location of insured
   location = uidoc.FieldGetText("LocAddress") & ", "
   location = location & uidoc.FieldGetText("LocCity") & ", "
   location = location & uidoc.FieldGetText("LocState") & " " _
   & uidoc.FieldGetText("LocZIP")
   ' Build subject line for reminder
   subject = "Inspection Due ("
   subject = subject & uidoc.FieldGetText("AccountName") & " - "
   subject = subject & uidoc.FieldGetText("PolicyNumber") & ")"
   calunid = createReminder( appdate, location, subject)
   Call uidoc.FieldSetText("CalendarUNID", calunid)
   Call uidoc.Save()
   Call uidoc.Refresh
End Sub


Function createReminder( dateTime As notesDateTime, _
   location As String, subjectStr As String ) As String
   Dim sess As New NotesSession
   Dim userMailDb As New NotesDatabase( "", "" )
   Call userMailDb.OpenMail
   Dim reminderDoc As New NotesDocument( userMailDb )
   Dim DTItem As NotesItem
 
    With reminderDoc
      .Form = "Appointment"
      .ReplaceItemValue "$Alarm", 1
      .ReplaceItemValue "$AlarmDescription", subjectStr
      .ReplaceItemValue "$AlarmMemoOptions", ""
      .ReplaceItemValue "$AlarmOffset", 0
      .ReplaceItemValue "$AlarmUnit", "M"

      .Subject = subjectStr
      .Alarms = "1"

      .CalendarDateTime = dateTime.lsLocalTime
      .StartDate = dateTime.lsLocaltime
      .StartTime = dateTime.lsLocaltime
      .StartDateTime = dateTime.lsLocaltime
  
      .EndDate = dateTime.lsLocaltime
      .EndTime = dateTime.lsLocaltime
      .EndDateTime = dateTime.lsLocaltime
  
      .AppointmentType = "4"
       .Location = location
      .Category = "Service Plan Activity"
      .Save True, False
       .ComputeWithForm True, False
      .Save True, False
      .PutInFolder( "$Alarms" )
   End With
   createReminder = reminderDoc.UniversalID
End Function

'Update Calendar Entry' button:

Hide-when formula: CalendarUNID=""

Lotusscript Code:

Sub Click(Source As Button)
   Dim ws As New NotesUIWorkspace
   Dim uidoc As NotesUIDocument
   Dim session As New NotesSession
   Dim calentry As NotesDocument
   Dim appdate As NotesDateTime
   Dim location As String
   Dim subject As String
   Dim calunid As String

   Set uidoc = ws.CurrentDocument
   Set appdate = New NotesDateTime(uidoc.FieldGetText("InspectionDate") _
   & " 08:00:00 AM")
   ' Get physical location of insured
   location = uidoc.FieldGetText("LocAddress") & ", "
   location = location & uidoc.FieldGetText("LocCity") & ", "
   location = location & uidoc.FieldGetText("LocState") & " " _
   & uidoc.FieldGetText("LocZIP")
   ' Build subject line for reminder
   subject = "Inspection Due ("
   subject = subject & uidoc.FieldGetText("AccountName") & " - "
   subject = subject & uidoc.FieldGetText("PolicyNumber") & ")"
   calunid = uidoc.FieldGetText("CalendarUNID")
   Call updateReminder(calunid, appdate, location, subject)
   Call uidoc.Save()
   Call uidoc.Refresh
End Sub

Sub updateReminder(unid As String, dateTime As notesDateTime, _
   location As String, subjectStr As String )
   Dim sess As New NotesSession
   Dim userMailDb As New NotesDatabase( "", "" )
   Call userMailDb.OpenMail
   Dim reminderDoc As NotesDocument
   Dim DTItem As NotesItem
 
   Set reminderDoc = userMailDB.GetDocumentByUNID(unid)
   If reminderDoc Is Nothing Then
      Msgbox "Failed to locate calendar entry."
       Exit Sub
    End If
   With reminderDoc
       .ReplaceItemValue "$AlarmDescription", subjectStr
      .Subject = subjectStr

      .CalendarDateTime = dateTime.lsLocalTime
      .StartDate = dateTime.lsLocaltime
       .StartTime = dateTime.lsLocaltime
      .StartDateTime = dateTime.lsLocaltime
  
       .EndDate = dateTime.lsLocaltime
      .EndTime = dateTime.lsLocaltime
      .EndDateTime = dateTime.lsLocaltime
  
      .Location = location
      .Save True, False
      .ComputeWithForm True, False
      .Save True, False
   End With
End Sub

 

 



---------------------
http://www.bleedyellow.com/blogs/texasswede/entry/createcalendarfromnotesdocument
Aug 11, 2011
505 hits



Recent Blog Posts
57


jQuery – A flexible way to show/hide sections
Wed, Aug 27th 2014 10:05a   Karl-Henry Martinsson
Yesterday Stephen Gainer blogged about a small Javascript problem he had. Brilliant!  I gave my customer exactly what he wanted!  No muss no fuss!  I’m sure you see where I’m going with this.  As soon as this was done, my customer came back to me and said he needed four more of these. My solution, […] [read] Keywords: development javascript
106


IBM ConnectED 2015 – registration open
Tue, Aug 19th 2014 8:45a   Karl-Henry Martinsson
IBM ConnectED, the conference formerly known as Lotusphere and Connect, has now opened the registration for the 2015 event. The “early bird” conference fee is $1,595 and on October 4 it goes up to the full price, $1,795. This is less than Lotusphere/Connect in the past, but the conference is also 20% shorter at 4 days […] [read] Keywords: ibm lotusphere
348


I am a victim of identity theft
Tue, Aug 12th 2014 7:53p   Karl-Henry Martinsson
This weekend I found out that I am a victim of identity theft. It is very unsettling, and feels like a total violation of my privacy. My girlfriend Chrissy and I were discussing the potential of me getting a new car in the next few months. I am having some repairs coming up on my […] [read] Keywords:
251


The joy of programming
Wed, Aug 6th 2014 12:36p   Karl-Henry Martinsson
I have been programming since the beginning of 1983. I started over 30 years ago with Basic, then went to Pascal after about 3 years. I then in fairly quick succession went to C, Visual Basic, VBA and then a few years later (in 1996) to Lotusscript. Along the way I also picked up Javascript, as well […] [read] Keywords: lotusscript javascript
434


Lotus Notes at my work threatened by Microsoft bug
Tue, Aug 5th 2014 2:10p   Karl-Henry Martinsson
The company I work for is owned by a large multinational corporation, and we are one of the few places not using Outlook/Exchange, but Lotus Notes. We have a substantial investment in custom applications written for the Notes platform, and with the deep integration between applications and email, we want to stay on the platform. […] [read] Keywords: domino lotus lotusnotes notes applications bug email exchange exchange integration microsoft outlook
310


ConnectED 2015 – Smaller and shorter but more technical
Thu, Jul 24th 2014 1:40p   Karl-Henry Martinsson
If you read the official IBM announcment for ConnectED 2015 posted by Mat Newman, you will notice a few interesting details. First of all, the event is shorter than previous years. It starts on Sunday and ends on Wednesday instead of Thursday. On Sunday IBM has scheduled the Leadership Alliance meeting, which previously been held in […] [read] Keywords: ibm
184


Recover lost SSL keyring password
Thu, Jul 24th 2014 10:45a   Karl-Henry Martinsson
About two years ago, our Network (as well as Domino) administrator left the company after 10 years. The other day our SSL certificate for one of our websites expired, and we wanted to use a newer wildcard certificate instead of a server specific certificate. The problem was that we did not have the password for […] [read] Keywords: domino lotus network password server




467


IBM Connect becomes IBM ConnectED in 2015
Wed, Jul 23rd 2014 12:25p   Karl-Henry Martinsson
IBM has announced the new name for the yearly conference in Orlando, the one most of us know (and still call) Lotusphere. For the last two years it was named Connect, and for 2015 IBM again changes the name, this time to ConnectED. The conference will be more technical than the last few years, according […] [read] Keywords: ibm lotusphere
214


Code snippet – DateClass
Mon, Jul 21st 2014 6:45p   Karl-Henry Martinsson
Here is a small Lotusscript class I wrote some years ago. I use it in a number of other classes where I need to use date functionality of different kind. For example, I have a class that communicates with a FoxPro database, using a COM object. Some of the methods in that class uses XML while […] [read] Keywords: domino lotusscript database xml
230


I am back.
Mon, Jul 21st 2014 5:25p   Karl-Henry Martinsson
On June 11 I had some major surgery at Medical City in Dallas. It was a planned surgery to remove part of my intestines to prevent future outbreaks of diverticulitis. I been having about 2-3 outbreaks a year for the last 12 years or so. Normally they perform surgery after just 2 severe cases. I was not […] [read] Keywords:




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - Mobile Edition