whats wrong with the code below? It has been working fine and all over sudden now its returning error message “Error: Notes Error: You are not authorized to perform that operation has occured on line: 39”
We use this agent to create a word document using different fields from a form to generate the entries on the document.
’ Initialize objects & variables
Dim ses As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim descItem As NotesItem
Dim sumItem As NotesItem
Dim specItem As NotesItem
’ Error handler
On Error Goto errhandle
’ Obtain the QueryString parameter from the OpenAgent url (the view alias is passed as query string here)
Set doc = ses.DocumentContext
v_docid$ = Strright(doc.Query_String_Decoded(0), "&")
If Isnull(v_docid$) Or v_docid$ = "" Then
Print |<script language=javascript>alert("No document is available to be exported to MS-Word!");</script>|
Exit Sub
End If
’ Set object values
Set db = ses.CurrentDatabase
Set lookupdoc = db.GetDocumentByUNID(v_docid$)
Set descItem = lookupdoc.getfirstitem("desc")
Set sumItem = lookupdoc.getfirstitem("summary")
Set specItem = lookupdoc.getfirstitem("specs")
’ Initialize the MS-Word object on the web
Print |Content-Type:application/vnd.ms-word|
Print |Content-Disposition: attachment; filename="preq.doc"|
’ Begin export of data from the Notes document into the MS-Word document
Print |<html><body>|
Print |<br><center><b>XXXXXXXXXX xxxxxxxxxx /b></center>|
Print |<center><b>JOB DESCRIPTION</b></center>|
Print |<br>TITLE: | & lookupdoc.title(0)
Print |<br>DEPT: | & lookupdoc.dept_name(0)
Print |<br>FLSA: | & lookupdoc.flsa(0)
Print |<br>REPORTS TO: | & lookupdoc.reports_to(0)
Print |<br>|
Print |<br><b>General Summary:</b>|
Print |<br>| & sumItem.text
Print |<br>|
Print |<br><b>Principal Duties and Responsibilities: </b>|
Print |<br>| & descItem.text
Print |<br>|
Print |<br><b>Job Specifications (education, years of professional experience,technical skills, etc)</b>|
Print |<br>| & specItem.text
Print |<br>|
Print |<br><br><b>Disclaimer</b>|
Print |<br>The above statements are intended to describe the general nature and level of work being performed by people assigned to this classification. They are not intended to be construed as and exhaustive list of all responsibilities, duties and skills required of personnel so classified.|
Print |<br>|
Print |<br><br><b>Review/Approvals</b>|
Print |<table border=0 cellpadding=0 cellspacing=10>|
Print |<tr><br><br></tr>|
Print |<tr><td>----------------------</td><td>------------------------</td><td>------</td></tr>|
Print |<tr><td>Name (please print)</td><td>Manager(signature)</td><td>Date</td></tr>|
Print |<tr><br><br></tr>|
Print |<tr><td>----------------------</td><td>--------------------------------</td><td>------</td></tr>|
Print |<tr><td>Name (please print)</td><td>Human Resources(signature)</td><td>Date</td></tr>|
Print |<tr><br><br></tr>|
Print |<tr><td>----------------------</td><td>-------------------------</td><td>------</td></tr>|
Print |<tr><td>Name (please print)</td><td>Employee(signature)</td><td>Date</td></tr>|
Print |</table>|
Print |</body></html>|
’ Finish writing to the MS-Word object on the web
Exit Sub
errhandle:
’ Store error message in agent’s log
Dim alog As New NotesLog( "My Agent Log" )
Call alog.OpenAgentLog
Call alog.LogAction( "Error:" & Error & " has occured on line: " & Erl )
Call alog.Close
Print |<script language=javascript>alert("Error:| & Error & | has occured on line: | & Erl & |");</script>|
Exit Sub
End Sub