Sub Initialize
-
Upload
aravind-sankaran -
Category
Documents
-
view
28 -
download
3
Transcript of Sub Initialize
Sub Initialize
Dim ws As New notesuiworkspace
Dim session As New NotesSession
Dim uidoc As notesuidocument
Dim currdb As notesdatabase
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim profileview As notesview
Dim profiledoc As notesdocument
Dim choice1 As String
Dim choice As Variant
Dim theans As Integer
Set currdb=session.CurrentDatabase
Set uidoc=ws.CurrentDocument
Set doc=uidoc.Document
Set profileview=currdb.GetView("VwDbProfile")
Set profiledoc=profileview.GetFirstDocument
If profiledoc Is Nothing Then
Msgbox "Blue Pages URL not found. Please contact Administrator. Exiting..."
'uidoc.Close
Exit Sub
End If
theans = Messagebox ("Do you have a prior approval to delegate a Manager other than your People Manager as your First-Line Approver?",4+64,"Lotus Notes")
If theans <>6 Then
Messagebox ("You cannot choose another People Manager")
Exit Sub
End If
choice1=uidoc.FieldGetText("MgrName")
choice=ws.PickListStrings(PICKLIST_NAMES)
If Isempty(choice) Then Exit Sub
Dim bpd As New BluePages(profiledoc.BluePages(0))
Dim results,results1,results2 As BPResults, mgr,mgr1 As BPResults
Dim name1 As New NotesName(choice(0))
Set results = bpd.GetPersonsByNotesID(name1.Canonical)
If results.succeeded() Then
If results.rows() = 0 Then 'No records found
Msgbox"Blue Pages Record Not Found"
Print "Blue Pages Record Not Found"
uidoc.Document.flag=1
'Call uidoc.Close
Exit Sub
Else
newvalue = results.GetColumn("MGR")(0)
If newvalue = "N" Then
Msgbox " The Employee you have selected does not have a People Manager Role as per the Blue Pages. Please select a valid name"
Elseif newvalue = "Y" Then
uidoc.Document.MgrName=name1.common
uidoc.Document.MgrNo=results.GetColumn("CNUM")(0)
uidoc.Document.MgrNotesID=name1.Abbreviated
End If
Print "BluePages Information Retrieved."
Call uidoc.Refresh
End If
Else
Print "Blue Pages record not found."
uidoc.Document.flag=1
Exit Sub
End If
End Sub