358 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
We are the IBM Champions
Wed, Dec 3rd 2014 172
Happy 25th birthday, Lotus Notes!
Thu, Nov 27th 2014 223
Gone fishing. Or rather gone scuba diving.
Sat, Nov 22nd 2014 131
Free Code – Class to read URL name-value pairs
Thu, Nov 20th 2014 219
Verizon and AT&T are tracking all your online activity
Fri, Oct 31st 2014 187
Nokia is dead
Wed, Oct 22nd 2014 278
October Community Webcast – Wednesday October 15
Mon, Oct 13th 2014 110
Top 10
Nokia is dead
Wed, Oct 22nd 2014 278
Export from Notes to Excel – 3 different ways
Wed, Nov 14th 2012 269
Export Notes view to Excel – with multi-value fields
Fri, Apr 5th 2013 261
“Migrate from legacy systems like Outlook/Exchange to IBM Notes”
Wed, Sep 3rd 2014 237
Happy 25th birthday, Lotus Notes!
Thu, Nov 27th 2014 223
Free Code – Class to read URL name-value pairs
Thu, Nov 20th 2014 219
Create and update Calendar reminders from Notes document
Thu, Aug 11th 2011 189
Verizon and AT&T are tracking all your online activity
Fri, Oct 31st 2014 187
We are the IBM Champions
Wed, Dec 3rd 2014 172
Free Tool: Analyze ACL in Notes Application/Database
Tue, Nov 15th 2011 154


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



Recent Blog Posts
172


We are the IBM Champions
Wed, Dec 3rd 2014 7:39p   Karl-Henry Martinsson
This morning I received a mail from IBM telling me that for the second year I was selected as one of the 96 IBM Champions. Last year I was very surprised to be selected and to be in the company of so many of the experts in the ICS/Lotus community that I for years looked up to […] [read] Keywords: ibm lotus community
223


Happy 25th birthday, Lotus Notes!
Thu, Nov 27th 2014 12:45p   Karl-Henry Martinsson
Today is the 25th birthday of Lotus Notes. It is the program responsible for me moving to the US, as well as being my career for the last close to 18 years. So, as you can see in the picture above, I am toasting this amazing software in IBM blue colors, courtesy of Curaçao Blue. […] [read] Keywords: ibm lotus notes
131


Gone fishing. Or rather gone scuba diving.
Sat, Nov 22nd 2014 1:05p   Karl-Henry Martinsson
I am currently away for a little over a week, taking a vacation in Curaçao. So no technical writing for a little bit. See you in December. [read] Keywords:
219


Free Code – Class to read URL name-value pairs
Thu, Nov 20th 2014 10:28a   Karl-Henry Martinsson
Here is another little code snippet I want to share. I use it all the time in my Lotusscript-based Domino web agents, and I figured that other could benefit from it as well. It is just an easy way to check for and read the name-value pairs (arguments) passed from the browser to the web […] [read] Keywords: domino lotusscript development
187


Verizon and AT&T are tracking all your online activity
Fri, Oct 31st 2014 2:45p   Karl-Henry Martinsson
As you may have read lately, Verizon have implemented a system that adds an HTTP header item in all web communication that originates from mobile phones on their network. Each phone/user get their own unique ID, which is transmitted to every website being visited (except if SSL is used), no matter if you have privacy/anonymous surfing […] [read] Keywords: mobile network
278


Nokia is dead
Wed, Oct 22nd 2014 8:05a   Karl-Henry Martinsson
Microsoft is taking a page out of IBM’s playbook and is killing off the Nokia brand. Future models of the smart phones in the Lumia series will be named Microsoft Lumia. Last month the Nokia Lumia 735 and 830 were launched, and they will probably be the last phones branded as Nokia. The mobile division of Nokia will […] [read] Keywords: ibm microsoft mobile




110


October Community Webcast – Wednesday October 15
Mon, Oct 13th 2014 9:05a   Karl-Henry Martinsson
This Wednesday it is again time for the monthly ICS community webcast. This month’s guest speaker will be Luis Guirigay, IBM SME for Social, Mobile and Cloud. Below is the description of the webcast agenda. Never before has there been more opportunity for IBM Notes Domino Enterprises! Join Luis Guirigay to learn about the latest […] [read] Keywords: domino ibm lotusnotes notes community mobile
91


Microsoft skipping Windows 9 – jumps to Windows 10
Tue, Sep 30th 2014 12:40p   Karl-Henry Martinsson
Microsoft unveiled the next version of Windows at a press event in San Francisco today. Surprisingly the successor to Windows 8 and 8.1 will not be called Windows 9 as everyone expected. Instead Microsoft jumps straight to Windows 10. One reason for this, according to Microsoft, is that the new operating system is such a big leap […] [read] Keywords: microsoft
135


Free Software – Password Reset for Notes/Domino
Wed, Sep 24th 2014 12:41p   Karl-Henry Martinsson
Earlier this year I was asked to research some alternatives for a web-based password reset function at my work. One of the larger support burdens are users who forget the passwords, especially in the first few days after changing it. We have a 90 day password lifespan, then a new password need to be picked. Some […] [read] Keywords: domino notes notesdomino password
77


#ThrowbackThursday – Worst Practives at Connect 2013
Thu, Sep 18th 2014 6:05a   Karl-Henry Martinsson
Paul Mooney and Bill Buchan returns with a brand new Worst Practices at IBM Connect 2013. This session alone is almost worth the cost to attend Lotusphere/Connect/ConnectED. There is a slight skip towards the end, when I had to switch batteries. Otherwise you have the whole session, including the warm-up performance. [read] Keywords: ibm lotusphere




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