329 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Jobs | Twitter | Bookmarks | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Lotus 1-2-3, SmartSuite and Organizer officially retired
Fri, May 17th 2013 211
Ender’s Game – First Movie Footage
Fri, May 3rd 2013 114
My recipes – All in one place
Mon, Apr 29th 2013 189
Useful utility to rename files in bulk
Tue, Apr 23rd 2013 140
The Enemy’s Gate is Down
Tue, Apr 16th 2013 242
How to set doctype on Notes forms
Thu, Apr 11th 2013 244
New LEGO Lord of The Rings sets this summer
Fri, Apr 5th 2013 295
Top 10
Review: Samsung Galaxy S3
Sun, Jun 24th 2012 2698
Code: Expanded Class for File Functions
Fri, Dec 21st 2012 785
Create and update Calendar reminders from Notes document
Thu, Aug 11th 2011 768
Code: Simple class for parsing file names
Thu, Dec 20th 2012 766
Creating PDF files from Notes documents
Thu, Nov 11th 2010 721
IBM Notes and Domino 9.0 Social Edition
Tue, Nov 13th 2012 673
Free Tool: Analyze ACL in Notes Application/Database
Tue, Nov 15th 2011 653
Export from Notes to Excel – 3 different ways
Wed, Nov 14th 2012 639
IBM Notes & Domino 9.0 Social Edition – Public beta now available!
Thu, Dec 13th 2012 613
How to write better code in Domino Designer – Part 1
Wed, Feb 20th 2013 583


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



Recent Blog Posts
211


Lotus 1-2-3, SmartSuite and Organizer officially retired
Fri, May 17th 2013 6:50a   Karl-Henry Martinsson
Earlier this week, IBM announced the withdrawal of marketing [sic!] of Lotus 1-2-3, together with Lotus SmartSuite and Lotus Organizer, effective 06/11/2013. Support ends on 09/30/2014. Lotus 1-2-3 version 3.0 for MS/DOS I personally never worked with 1-2-3 myself. When I started with computers in school, we used CP/M-86 as the operating system, and had a spreadsheet program developed specifically for use in the Swedish schools. My first job after high school was with Microsoft in 1988, so my fi [read] Keywords: formula language ibm lotus notes microsoft office properties
114


Ender’s Game – First Movie Footage
Fri, May 3rd 2013 1:45p   Karl-Henry Martinsson
Preview for the teaser trailer, to be released on May 7. You get to see about 10 seconds of movie footage here, and I have to say it looks pretty good to me. [read] Keywords:
189


My recipes – All in one place
Mon, Apr 29th 2013 11:06a   Karl-Henry Martinsson
For many years, I have enjoyed cooking and baking. One reason could be because I like good food. But it is also logical, similar to programming. You have instructions you follow, but you can still modify them, as long as you know how different ingredients react with each other and with heat, liquids, etc. Cooking is a combination of programming, chemistry and physics. Perfect for a geek! I often get questions about how I made a particular dish. Many of the recipes have been published on my blog, [read] Keywords:
140


Useful utility to rename files in bulk
Tue, Apr 23rd 2013 3:20p   Karl-Henry Martinsson
Earlier today I had to rename about 400 image files, and I was looking for a convenient tool that would help me out. I had to remove part of the filename, in the middle of the filename, which was a bit tricky. I found a very useful tool, called Bulk Rename Utility. It does not have the most user-friendly interface, but it is very powerful. And the best thing is that it is free. You can download it here. This is the somewhat messy but very powerful user interface… [read] Keywords: interface
242


The Enemy’s Gate is Down
Tue, Apr 16th 2013 5:04p   Karl-Henry Martinsson
Teaser poster for the upcoming movie adaptation of Orson Scott Card’s book Ender’s Game. I really enjoyed the book (as well as the parallel story in Ender’s Shadow), and hope the movie will stay at least somewhat close to the story in the books. According to the author, the movie will use elements from both books. If you haven’t read the books, I can highly recommend them. [read] Keywords: wiki
244


How to set doctype on Notes forms
Thu, Apr 11th 2013 1:29p   Karl-Henry Martinsson
Who redesigning my website to use Bootstrap, I ran into a problem. The navbar (meny) did not render correctly in Internet Explorer 9, despite looking perfect in Firefox and Internet Explorer 10. There are several discussions about this problem on StackOverflow and other forums, and the solution is simply to add on the first line of the HTML code. However, IBM Domino automatically adds a different doctype string, and there is no database or form property to change/set the correct value. But ther [read] Keywords: domino ibm lotusnotes notes database development firefox javascript twitter




295


New LEGO Lord of The Rings sets this summer
Fri, Apr 5th 2013 1:51p   Karl-Henry Martinsson
As the regular reader of this blog may have noticed, I am a huge Lord of the Rings fan, and I also enjoy building LEGO. There are four new LEGO sets in the Lord of The Rings series to be released this summer (in June, according to TheBrickBlogger.com). They are: 79005 – The Wizard Battle, 113 pieces, $12.99 79006 – The Council of Elrond, 243 pieces, $29.99 79007 – Battle at the Black Gate , 656 pieces, $59.99 79008 – Pirate Ship Ambush, 756 pieces, $99.99 Pictures below from The [read] Keywords:
575


Export Notes view to Excel – with multi-value fields
Fri, Apr 5th 2013 9:26a   Karl-Henry Martinsson
A few days ago, a question was asked on StackOverflow about how to export the content of a Notes view to Excel. The caveat was that some columns contained multiple values, but not on all documents. To solve this, I wrote a Lotusscript class that will export view data as either CSV or as an HTML table, both can then be saved to a file and opened in Excel. I am posting the code below. Enjoy! %REM Agent View Export Created Mar 27, 2013 by Karl-Henry Martinsson Description: Code to export a [read] Keywords: agent lotus lotusscript notes database server
491


Should everyone be a programmer?
Tue, Apr 2nd 2013 2:47p   Karl-Henry Martinsson
For years, there has been a debate if anyone can (or should) learn programming or not. While reading the Notes and Javascript groups on LinkedIn, as well as the Notes forums on IBM developerWorks, I have read more than one post where someone wants to learn Javascript or Notes programming, but don’t have any programming experience/knowledge. Can anyone learn to program? No. I would say half the population could learn at least the basics and mechanics of programming.  So should everyon [read] Keywords: atlas domino formula language ibm lotus lotusscript notes ajax community css facebook java javascript linkedin wiki xml
230


And I am up and running!
Thu, Mar 21st 2013 12:45p   Karl-Henry Martinsson
Downloaded the Notes client with Domino Designer and Administrator, installed it on top of the public beta from December in a viritual machine (with 1GB memory). Install went without any problems, and the client starts up fine. All settings and bookmarks were preserved from the beta. My workspace in IBM Notes 9.0 Social Edition It just works. [read] Keywords: domino ibm lotusnotes notes notes client workspace




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