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

Script Help

I use the below code to populate my calendar for a vacation database.  However when I look in my calendar only an icon shows up. If I roll my mouse over it then it will say My Name - Vacation - Approved by.  But I want it to display vacation or something without having to place my mouse over it. How would I update this code to do that?
Code is as follows:

Sub Click(Source As Button)
     Dim session As New NotesSession
     Dim workspace As New NotesUIWorkspace
     Dim Doc As NotesDocument
     Dim db As NotesDatabase
     Dim UIDoc As NotesUIDocument
     Dim CurDoc As NotesDocument
     Dim servername As String
     Dim user As String
     Dim reg As New NotesRegistration
     Dim regserver As String
     Dim mailserver As String
     Dim mailfile As String
     Dim maildomain As String
     Dim mailsystem As Integer
     Dim profile As String
     
     Set CurDoc = workspace.CurrentDocument.Document
     Set db = session.CurrentDatabase
     servername = db.Server
     user = session.CommonUserName
     reg.RegistrationServer = servername
     
     Call reg.getUserInfo(user, mailserver, mailfile,  maildomain, mailsystem, profile)
     
     Set db = session.GetDatabase(servername,mailfile)
     Set doc = db.CreateDocument
     doc.form = "Appointment"
0
schmad01
Asked:
schmad01
  • 4
  • 3
  • 2
  • +1
1 Solution
 
zvonkoCommented:
please add the rest of the code.
0
 
Jean Marie GeeraertsCommented:
Is this the default calendar of your mailfile you are using?
Here's the formula for the info displayed on the calendar view:
xxLocation := @If(@Length(Room); "Location: " + @Name([CN];@Subset(Room;1)); @Length(Location);"Location: " + Location; "");
xxChair := @If(AppointmentType = "3"; "Chair: " + @Name([CN];Chair); TaskType = "2"; "Owner: " + @Name([CN];Chair);"");

@Trim(Subject : xxLocation : xxChair)

From this you can see that you need to specify a subject in your appointment document for this to be displayed on the calendar.
If you also want people to know where you are on vacation, you can specify this in the location field and this too will be displayed on the calendar.

So you would need to include in your script at least the following:
doc.Subject="Vacation"

and optionally you could include:
doc.Location="Sunny California"

Regards,
JM
0
 
ArunkumarCommented:
The subject & optional suggestion from zvo is what is missing.

Hi Bro !!!

I wont be around for the next 4 days. You know what the big event is right ? Will write you guys a big email on how things went okay ?  Take it easy bro....
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
zvonkoCommented:
Bro, take you it not too hard!
You will need your powers for Aruns to come :)
0
 
Jean Marie GeeraertsCommented:
You meant from jerrith, I suppose Arun?
Walking with your head in the clouds allready because your girlfriend is coming over?
0
 
ArunkumarCommented:
3 years Guys!  Doesn't sound pretty exciting ?

I have personalized gifts, Choclates, A HUGE teddy bear, A LapTop  above all Myself dressed in Full (hee hee hee)

All set to go.  5 more hours and i will be on my way...

As Jerrith pointed out, I am already walking on my head among the clouds.

:-)
0
 
schmad01Author Commented:
Sorry , here is the whole code:

Sub Click(Source As Button)
     Dim session As New NotesSession
     Dim workspace As New NotesUIWorkspace
     Dim Doc As NotesDocument
     Dim db As NotesDatabase
     Dim UIDoc As NotesUIDocument
     Dim CurDoc As NotesDocument
     Dim servername As String
     Dim user As String
     Dim reg As New NotesRegistration
     Dim regserver As String
     Dim mailserver As String
     Dim mailfile As String
     Dim maildomain As String
     Dim mailsystem As Integer
     Dim profile As String
     
     Set CurDoc = workspace.CurrentDocument.Document
     Set db = session.CurrentDatabase
     servername = db.Server
     user = session.CommonUserName
     reg.RegistrationServer = servername
     
     Call reg.getUserInfo(user, mailserver, mailfile,  maildomain, mailsystem, profile)
     
     Set db = session.GetDatabase(servername,mailfile)
     Set doc = db.CreateDocument
     doc.form = "Appointment"
     doc.AppointmentType = "2"
     doc.Subject = CurDoc.ReqType(0) & "--" & CurDoc.Name(0) & ". (Approved by " &  CurDoc.Manager(0) & ") " 
     doc.StartDate = CurDoc.StartDate1(0)
     doc.Duration = CurDoc.CalDays(0)
     doc.ExcludeFromView = "D"
     Set UIDoc = Workspace.EditDocument(True,doc)
     Set doc = UIDoc.Document
     doc.StartDate = CurDoc.StartDate(0)
     doc.EndDate = CurDoc.EndDate(0)
     Call uidoc.Reload
End Sub
0
 
Jean Marie GeeraertsCommented:
Hm, I don't quite understand what you are trying to do here.
First you create a new document:
set doc=db.CreateDocument
Then you set the correct fields and afterwards you reassign the value of doc:
set doc=UIDoc.Document

However you never saved the new document, so logically no info is included there!!

Before you change the reference to another document, save it using
Call doc.Save(True,False)

so the fragement of your code would be:

    Set db = session.GetDatabase(servername,mailfile)
    Set doc = db.CreateDocument
    doc.form = "Appointment"
    doc.AppointmentType = "2"
    doc.Subject = CurDoc.ReqType(0) & "--" & CurDoc.Name(0) & ". (Approved by " &  CurDoc.Manager(0) & ") " 
    doc.StartDate = CurDoc.StartDate1(0)
    doc.Duration = CurDoc.CalDays(0)
    doc.ExcludeFromView = "D"
    'First save your changes, before you reassign the document!
    'The reference doc is a background document and not in the UI.
    Call doc.Save(True,False)
    'Before you can use the background document, you need to save it
    Set UIDoc = Workspace.EditDocument(True,doc)
    Set doc = UIDoc.Document
    doc.StartDate = CurDoc.StartDate(0)
    doc.EndDate = CurDoc.EndDate(0)
    Call uidoc.Reload
0
 
schmad01Author Commented:
The code is on a button that is on a vacation document that has already been saved. It gives you the option of putting the information in your calendar. (Notes 5, by the way).
0
 
schmad01Author Commented:
Thanks, Jerrith!
0
 
Jean Marie GeeraertsCommented:
You're welcome. Thanks for the A :-)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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