• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 22
  • Last Modified:

How to add a link to an Appointment via LotusScript

I have the following code to create an appointment and works good but I need to add a link to the appointment


Sub Initialize
      Dim ws As New NotesUIWorkspace
      Dim session As New NotesSession      
      Dim maildb As New NotesDatabase( "", "" )
      Dim db As NotesDatabase
      Dim doc As NotesDocument
      Dim uidoc As NotesUIDocument
      Dim auditado,lider,observador,acompañante,tecnico,coordinadorQA,gerente,jefedepto As String
      
      Set uidoc=ws.currentdocument
      
      If ws.currentdocument.editmode Then
            Call ws.currentdocument.save      
      End If
      
      Set db = session.currentdatabase
      Call maildb.OpenMail
      Set doc = maildb.createdocument
      
      'get the mails of the invited
      auditado = uidoc.Fieldgettext("cargoAuditado_1")
      lider = uidoc.Fieldgettext("cargoAuditado_1_1")
      observador = uidoc.Fieldgettext("cargoAuditado_1_1_1")
      acompañante = uidoc.Fieldgettext("correoAcompanante")
      tecnico = uidoc.Fieldgettext("correoAcompanante_1")
      
      doc.form            = "Appointment"
      doc.AppointmentType = "3"
      doc.subject         = "Notificación Auditoría " + uidoc.Fieldgettext("numeroauditoria")
      doc.StartDate       = CDat(uidoc.Fieldgettext("n1_5_1"))
      doc.StartDateTime   = CDat(uidoc.Fieldgettext("horaplaneada"))
      doc.EndDateTime     = CDat(uidoc.Fieldgettext("horaplaneada_1"))
      doc.TimeRange       = Now
      
      doc.Chair           = session.username
      doc.sequencenum     = 1
      
      Call doc.ComputeWithForm(True,False)
      Call session.SetEnvironmentVar("AutoCloseAppointment","1")
      
      Set uidoc = ws.editdocument(True,doc)
      
      'fill the required persons
      Call uidoc.FieldSetText("EnterSendTo", auditado+","+lider+","+observador+","+acompañante+","+tecnico )
      Call uidoc.FieldSetText("Location", "Oficina del Auditado" )
End Sub
0
ruedaj
Asked:
ruedaj
  • 3
2 Solutions
 
Sjef BosmanGroupware ConsultantCommented:
You want a link to the appointment, but where do you want it? Plus, the appointment hasn't been saved yet, so you can't create the link right now.

> Dim auditado,lider,observador,acompañante,tecnico,coordinadorQA,gerente,jefedepto As String
Only jefedepto will be a String, the rest are Variant variables. In LotusScript, you have to specify each variable separately, either on separate lines or separated by commas, like
      Dim a As String, b As String

A last remark: instead of using uidoc.FieldGetText I prefer to use uidoc.document.GetItemValue. It returns an array of the interpreted values. Example: if the field n1_5_1 is defined as a Date value in the form, instead of
      doc.StartDate       = CDat(uidoc.Fieldgettext("n1_5_1"))
you can use
      doc.StartDate       = uidoc.Document.GetItemValue("n1_5_1")(0)
or the shorthand version
      doc.StartDate       = uidoc.Document.n1_5_1(0)
And you can define a variable of type NotesDocument that contains uidoc.Document, to make it even more readable.
0
 
ruedajAuthor Commented:
Sjef thanks for your answer and suggestions

actually The person that use the appointment put the link in manual form but we look for that any people  use the appointment script
0
 
Sjef BosmanGroupware ConsultantCommented:
As I said, the Appointment document has to be saved at least once *before* you can get a link to it. That's only possible if you make some changes in the Appointment form.
0
 
Sjef BosmanGroupware ConsultantCommented:
IMHO my answers are correct here.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now