354 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Code snippet – jQuery
Sat, Mar 15th 2014 322
World Wide Web turning 25 years this week
Fri, Mar 14th 2014 158
Connect 2014 – Day 0 (Saturday)
Mon, Jan 27th 2014 261
Connect 2014 – Chilly evenings in Orlando
Fri, Jan 24th 2014 293
Connect 2014 – More about the sessions
Wed, Jan 22nd 2014 324
Connect 2014 – 3 days left until I leave for Orlando
Wed, Jan 22nd 2014 302
Connect 2014 – My preliminary schedule
Wed, Jan 15th 2014 158
Top 10
Pool party or no pool party, that is the question – or is it?
Mon, Jan 13th 2014 660
Export Notes view to Excel – with multi-value fields
Fri, Apr 5th 2013 498
Connect 2014 – More about the sessions
Wed, Jan 22nd 2014 324
Code snippet – jQuery
Sat, Mar 15th 2014 322
Free Tool: Analyze ACL in Notes Application/Database
Tue, Nov 15th 2011 308
Create and update Calendar reminders from Notes document
Thu, Aug 11th 2011 305
Connect 2014 – 3 days left until I leave for Orlando
Wed, Jan 22nd 2014 302
Connect 2014 – Chilly evenings in Orlando
Fri, Jan 24th 2014 293
Review: Samsung Galaxy S3
Sun, Jun 24th 2012 266
Connect 2014 – Day 0 (Saturday)
Mon, Jan 27th 2014 261


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
306 hits



Recent Blog Posts
322


Code snippet – jQuery
Sat, Mar 15th 2014 11:43a   Karl-Henry Martinsson
This morning I was working on a web application, and I came up with a pretty neat and simple little solution. So I just wanted to share it, in case anyone else need something similar. I have a webpage with an HTML form. Each input tag has an attribute called notesfield, matching the name of the field in Notes where the value is stored: First Name Initial Last Name Then I created a simple function that will call an agent on the Domino server, which will return all th [read] Keywords: agent domino notes ajax application database server
158


World Wide Web turning 25 years this week
Fri, Mar 14th 2014 3:02p   Karl-Henry Martinsson
In some articles it is claimed that Internet turns 25 years old this week, which of course is not true. But the World Wide Web is. It was on March 12, 1989 that Tim Berners-Lee wrote a proposal for a hypertext system that would become what we call “the web”. In 1991 the first webpage was created and published at CERN. Since then the web has exploded. I first got in touch with web pages and HTML in 1994, and in 1995 I had my own little server running on my work computer. I don’t [read] Keywords: lotus notes ajax development email google instant messaging javascript network server wiki wireless
261


Connect 2014 – Day 0 (Saturday)
Mon, Jan 27th 2014 6:03a   Karl-Henry Martinsson
After not hearing the alarm this morning and therefore missing my original flight from DFW to MCO (Orlando International), I got booked on the next flight. I was in the air just a couple of hours late, and arrived at Dolphin in time for BALD at Big River on the Boardwalk. Had a great time connecting with friends after a year of not seeing many of them. Of course I got a hug from Mat Newman, meaning that IBM Connect started for real. Låter I was going to hit ESPN, but due to changes there, [read] Keywords: ibm
293


Connect 2014 – Chilly evenings in Orlando
Fri, Jan 24th 2014 9:42a   Karl-Henry Martinsson
Countdown to Connect 2014 It looks like the evenings next week week will be a little bit chilly. So it might be a good idea to bring something warm to wear for the Tuesday party at Disney’s Hollywood Studios. Hope to see you in Orlando! [read] Keywords: collaboration ibm
324


Connect 2014 – More about the sessions
Wed, Jan 22nd 2014 12:02p   Karl-Henry Martinsson
Countdown to Connect 2014 The sessions at Lotusphere/Connect are focusing more and more on XPages each year. I don’t think there are really any sessions about classic Notes development this year. Currently I am not able to use XPages at work, due to the client environment we run (Lotus Notes 8.5.2 Basic in Citrix), but the sessions are still great (see video below) and I am learning new things every year. Hopefully we will soon switch the client to IBM Notes 9.0 so I can use all th [read] Keywords: admin domino ibm lotus lotusphere notes xpages citrix development network office
302


Connect 2014 – 3 days left until I leave for Orlando
Wed, Jan 22nd 2014 9:42a   Karl-Henry Martinsson
Wednesday morning. In exactly 3 days I will arrive in Orlando, after a short flight from Dallas. My preparations for the trip are almost done, I just have to charge up some batteries for cameras, dig out some spare USB cables and purchase a few last-minute items. So what is it that is so exciting about Lotusphere (now Connect)? How do you explain it to someone who never been there? In the past, several members of the community have brought their significant other to Orlando, at least for a few [read] Keywords: domino lotus lotusphere notes community exchange exchange office wiki
158


Connect 2014 – My preliminary schedule
Wed, Jan 15th 2014 8:08a   Karl-Henry Martinsson
I have now created my preliminary schedule for Connect 2014. There are two only sessions that collide (on Tuesday), and I have not been able to find any repeats for them. That is how often has been at Lotusphere, but I would say that in the later years, the collisions have been fewer and fewer, thanks to more repeats and (perhaps) smarter scheduling. Monday afternoon is when I have set time aside to visit the showcase and the labs. I also have a little bit of time after lunch Wednesday. As [read] Keywords: ibm lotusphere




660


Pool party or no pool party, that is the question – or is it?
Mon, Jan 13th 2014 10:11a   Karl-Henry Martinsson
With the name change to Connect in 2013, the welcome reception/pool party changed somewhat. Instead of taking place at the pools/beach area between Swan and Dolphin, it started inside in the showcase area (Atlantic hall), and then moved outside for food, drinks and entertainment. From what it looks like on the Connect 2014 website, and based on Chris Miller’s blog post, it sounds like the traditional poolside party is no more. The Connect website also only mention snacks and beverages. [read] Keywords: atlantic ibm lotusphere
134


Connect 2014 – Survive the week!
Mon, Jan 6th 2014 7:02a   Karl-Henry Martinsson
Countdown to Connect 2014 In exactly 3 weeks, thousands of us will be sitting in the Northern Hemisphere ballroom at the Dolphin hotel in Orlando. We have already been involved in some social activities on Saturday with soccer, BALD and ESPN, followed by a full day of jumpstart and master class sessions on Sunday. Sunday evening there was the big welcome reception on the beach between Swan and Dolphin. Some of us may have continued to Kimonos afterwards, or perhaps to Jelly Rolls dueling [read] Keywords: collaboration ibm lotusphere apple office
198


Connect 2014 – Plan your schedule!
Fri, Jan 3rd 2014 7:22p   Karl-Henry Martinsson
Countdown to Connect 2014 We already talked about how to prepare for Connect by getting everything together, like batteries, chargers, comfortable shoes and questions for the IBM developers. But you also should plan ahead for the sessions. You will spend hours listening to experts from IBM as well as from business partners from all around the world. There are always several sessions at the same time, sometimes making it hard to choose. There are also the longer Show n’ Tell sessions, s [read] Keywords: collaboration ibm lotusphere notes application archive database development mobile planetlotus planetlotus.org




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