359 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Nokia is dead
Wed, Oct 22nd 2014 167
October Community Webcast – Wednesday October 15
Mon, Oct 13th 2014 82
Microsoft skipping Windows 9 – jumps to Windows 10
Tue, Sep 30th 2014 211
Free Software – Password Reset for Notes/Domino
Wed, Sep 24th 2014 479
#ThrowbackThursday – Worst Practives at Connect 2013
Thu, Sep 18th 2014 160
More on IBM ConnectED 2015
Wed, Sep 17th 2014 218
Survey about Notes and Domino directions
Tue, Sep 16th 2014 274
Top 10
Pool party or no pool party, that is the question – or is it?
Mon, Jan 13th 2014 731
“Migrate from legacy systems like Outlook/Exchange to IBM Notes”
Wed, Sep 3rd 2014 602
Export from Notes to Excel – 3 different ways
Wed, Nov 14th 2012 577
Export Notes view to Excel – with multi-value fields
Fri, Apr 5th 2013 570
IBM Connect becomes IBM ConnectED in 2015
Wed, Jul 23rd 2014 547
Lotus Notes at my work threatened by Microsoft bug
Tue, Aug 5th 2014 519
Free Software – Password Reset for Notes/Domino
Wed, Sep 24th 2014 479
I am a victim of identity theft
Tue, Aug 12th 2014 431
ConnectED 2015 – Smaller and shorter but more technical
Thu, Jul 24th 2014 406
Create and update Calendar reminders from Notes document
Thu, Aug 11th 2011 368


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



Recent Blog Posts
167


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
82


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
211


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
479


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
160


#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
218


More on IBM ConnectED 2015
Wed, Sep 17th 2014 12:05p   Karl-Henry Martinsson
This morning Kristin Keene from IBM talked more about the upcoming IBM ConnectED 2015 in January at the ICS Community webcast. IBM realized that the last few years they been swinging over too much to the business side, and is now going back to a much more technical conference. As I mentioned the other day, […] [read] Keywords: ibm community




274


Survey about Notes and Domino directions
Tue, Sep 16th 2014 2:45p   Karl-Henry Martinsson
PSC is doing a community survey about the direction of IBM Notes and Domino. John Head, Director of Enterprise Collaboration at the Chicago-based consulting company PSC Group explains that it’s not about gathering data, the (optional) email address collected will only be used to notify about the result.PSC promises to share the full results publically. I […] [read] Keywords: collaboration domino ibm notes community consulting email enterprise
163


Two more days to thank someone
Mon, Sep 15th 2014 5:45p   Karl-Henry Martinsson
It is now just two days left to nominate IBM Champions. So if you know someone who have been helping the community, perhaps through video tutorials, blogs, presenting at (or organizing) conferences or answering questions on different forums, submit a nomination. This is how IBM explains what a Champion is: An IBM Champion is someone who […] [read] Keywords: ibm community
231


IBM ConnectED agenda published
Fri, Sep 12th 2014 9:00a   Karl-Henry Martinsson
The agenda for IBM ConnectED (the conference formerly known as Lotusphere and IBM Connect) has now been posted. As previously announced, the conference is one day shorter than before, ending already on Wednesday. There are no jumpstart sessions listed for Sunday, but the Master Class sessions are returning that  day. The individual sessions have not been […] [read] Keywords: ibm lotusphere
153


#ThrowbackThursday – My old HP calculators
Thu, Sep 11th 2014 6:57a   Karl-Henry Martinsson
I have previously here on my blog mentioned my preference for HP calculators. Our first calculator at home was the HP-21, with a red LED display, which we got in late 1975 (if I remember correctly), soon after it was released. My parents used it for all different kinds of calculations, especially taxes (back then the Swedish tax system […] [read] Keywords:




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