357 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Two more days to thank someone
Mon, Sep 15th 2014 81
IBM ConnectED agenda published
Fri, Sep 12th 2014 164
#ThrowbackThursday – My old HP calculators
Thu, Sep 11th 2014 90
#ThrowbackThursday – World War 1
Thu, Sep 4th 2014 99
#ThrowbackThursday – JMP 101 from Lotusphere 2012
Thu, Sep 4th 2014 129
“Migrate from legacy systems like Outlook/Exchange to IBM Notes”
Wed, Sep 3rd 2014 360
Experience the power of a bookbook™
Wed, Sep 3rd 2014 94
Top 10
Pool party or no pool party, that is the question – or is it?
Mon, Jan 13th 2014 1395
Export Notes view to Excel – with multi-value fields
Fri, Apr 5th 2013 797
Export from Notes to Excel – 3 different ways
Wed, Nov 14th 2012 722
In memory of Tim Tripcony
Mon, May 12th 2014 648
Free Tool: Analyze ACL in Notes Application/Database
Tue, Nov 15th 2011 553
Create and update Calendar reminders from Notes document
Thu, Aug 11th 2011 526
Things we don’t want to think about
Thu, May 15th 2014 523
IBM Connect becomes IBM ConnectED in 2015
Wed, Jul 23rd 2014 493
jQuery – An Overview
Fri, Jul 19th 2013 456
Lotus Notes at my work threatened by Microsoft bug
Tue, Aug 5th 2014 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
527 hits



Recent Blog Posts
81


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
164


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
90


#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:
99


#ThrowbackThursday – World War 1
Thu, Sep 4th 2014 1:05p   Karl-Henry Martinsson
OK, this is a pretty extreme #ThrowbackThursday, but I wanted to promote a blog I have been reading since the beginning of the year. Arthur Linfoot, who took part in World War 1, wrote a diary every day from January 1 1914 to December 31 1918. It was written in Pitman’s shorthand, and his son […] [read] Keywords:
129


#ThrowbackThursday – JMP 101 from Lotusphere 2012
Thu, Sep 4th 2014 7:57a   Karl-Henry Martinsson
I recorded this video of the session JMP101 IBM Lotus Domino XPages JumpStart at Lotusphere 2012 in Orlando. The conference, later renamed IBM Connect and now renamed again to IBM ConnectED will take place again in January 2015. Perhaps this video will get you inspired to do some XPages development, or you can show it […] [read] Keywords: domino ibm lotus lotusphere xpages development
360


“Migrate from legacy systems like Outlook/Exchange to IBM Notes”
Wed, Sep 3rd 2014 4:32p   Karl-Henry Martinsson
At Connect/Lotusphere 2013 IBM was showing up a migration tool for Notes/Domino 9.0, used to move users “from legacy systems like Outlook/Exchange to the world class mail and collaboration platform Notes/Domino”. I don’t think I posted this recording on my blog before. Enjoy! [read] Keywords: collaboration domino ibm lotusphere notes exchange exchange outlook
94


Experience the power of a bookbook™
Wed, Sep 3rd 2014 4:25p   Karl-Henry Martinsson
[read] Keywords:
156


Nominations for IBM Champions are now open!
Tue, Sep 2nd 2014 12:52p   Karl-Henry Martinsson
The nominations for IBM Champions for 2015 is now open. If there is someone in the ICS (IBM Collaborative Solutions) community whom you want to show appreciation for their work, go here and nominate him or her. You can only nominate non-IBMers. So who is deserving to be an IBM Champion? Well, you can see […] [read] Keywords: ibm lotus community




122


Is the break-through for smart watches almost here?
Thu, Aug 28th 2014 8:25a   Karl-Henry Martinsson
In a few days, Motorola will present their highly anticipated Moto 360 smart watch, and at the IFA trade show in Berlin next week LG will show off their latest entry in the battle for the hearts (and wrists) of geeks everywhere, the G Watch R. Both watches are round, as opposed to previous entries […] [read] Keywords:
175


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




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