Solved

Script Help

Posted on 2002-07-11
11
189 Views
Last Modified: 2013-12-18
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
Comment
Question by:schmad01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 10

Expert Comment

by:zvonko
ID: 7148346
please add the rest of the code.
0
 
LVL 8

Accepted Solution

by:
Jean Marie Geeraerts earned 65 total points
ID: 7148355
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
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7148620
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
Independent Software Vendors: 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!

 
LVL 10

Expert Comment

by:zvonko
ID: 7148681
Bro, take you it not too hard!
You will need your powers for Aruns to come :)
0
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
ID: 7148706
You meant from jerrith, I suppose Arun?
Walking with your head in the clouds allready because your girlfriend is coming over?
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7149177
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
 

Author Comment

by:schmad01
ID: 7150807
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
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
ID: 7153500
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
 

Author Comment

by:schmad01
ID: 7154131
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
 

Author Comment

by:schmad01
ID: 7222331
Thanks, Jerrith!
0
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
ID: 7228243
You're welcome. Thanks for the A :-)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question