Doc not deleted by schedule agent

Hi,

I am trying to delete a doc using schedule agent but it is not deleting. I am using doc.Remove true to delete doc. If I run this agent manually, then doc gets deleted but not when agent runs in background. I have full access to db.

Thanks for help.

Subject: Doc not deleted by schedule agent

“Background”, as in on the server or on your own Notes Client?

Check the log.nsf file of the server or client, under Misc. Events. Also right click on the Agent in Designer and select “Log”

In one of these you will hopefully see an error message with a clue where to check

Subject: RE: Doc not deleted by schedule agent

check if server is allowed to run agents in database. it must be in ACL too.

if its already there , check log.nsf or paste code here.

Subject: RE: Doc not deleted by schedule agent

Also, check that the signer of agent have access in the server document to execute the agent.

Subject: Doc not deleted by schedule agent (found problem)

When I checked the log, saw not authorized to delete doc message. This agent runs on server when new mail arrives(its a mail in db). The agent signer have full access to all servers. This signer ID is used to sign all design elements across company.Same agent runs fine on production server with this signer. I checked the server doc in staging server which is same as prod server doc. Still trying to figure out the issue. Thanks to everyone for the help and quick response.

Thanks

Rao

Subject: RE: Doc not deleted by schedule agent (found problem)

Before mail arrives agents are run by the router, they do not run in the actual db where the agent is located so you have to get a handle to the target db. Try using After mail arrives as the trigger instead and it should work. Post your code if it does not so we can see what you are trying to do.

Subject: RE: Doc not deleted by schedule agent (found problem)

Paul, thanks for response. Sorry it was my mistake that agent runs after new mail has arrived event and not before.Here is the code…

'The sub that converts incoming Memos into Emails for this application

Sub Incoming

Dim session As New NotesSession

Dim db As NotesDatabase 

Dim view As NotesView

Dim memo As NotesDocument

Dim email As NotesDocument

Dim bodyMemo As NotesItem



Set db = session.CurrentDatabase

GetNextMemo:

Set view = db.GetView( "memolu" )

Set memo = view.GetFirstDocument



If Not memo Is Nothing Then 

	Set email = New NotesDocument(db)

      'get the memo fields

	email.Form = "email"

	email.From = parseAddr(memo.From(0))

	email.Subject = memo.Subject         

	If memo.HasItem("Body") Then 

		Set bodyMemo = memo.GetFirstItem("Body")          

		bodyMemo.CopyItemToDocument  email, "Body"

		bodyMemo.CopyItemToDocument  email, "Response"

	Else

		email.Body = "No message was contained in this email."

		email.Response = "No message was contained in this email."

	End If 

	email.ResponseSubject = "Re: " + memo.Subject(0)

	

	

	email.tRCV = Now          

	

	email.Notes = ""

	

	email.Status = "Open"                    

	

      'extract fromAddress username and lookup client

	Dim ClientLocalPart As String

	Dim clientlu As NotesView

	Dim client As NotesDocument

	ClientLocalPart = parseLocalPart(memo.SendTo(0))  

	ClientLocalPart = extractClient(ClientLocalPart)

	Set clientlu = db.GetView( "clientlu" )

	Set client = clientlu.GetDocumentByKey(ClientLocalPart, False)

	If client Is Nothing Then

		Set client = clientlu.GetDocumentByKey("UNKNOWN", False)

		If client Is Nothing Then

			Print "Fatal Error in CERS:  No Unkown Client has been set up"

			Print "Resolution:  Create a client in CERS with name UNKNOWN and assign default supervisor and priority."

			Exit Sub

		End If               

	End If          

	email.Client = client.ClientName(0)

	

	If client.Priority(0) = Null Then

		Print "Fatal Error in CERS:  Client has no Priority time"

		Print "Resolution:  Ensure that all clients have priority times set up."

		Exit Sub               

	End If

	email.Priority = Cint(client.Priority(0))

	

	If client.CSRs(0) = "" Then

		Print "Fatal Error in CERS:  Client has no CSRs declared"

		Print "Resolution:  Ensure that all clients have CSRs assigned."

		Exit Sub               

	End If

	email.CSRs = client.CSRs

	

	If client.SVRs(0) = "" Then

		Print "Fatal Error in CERS:  Client has no SVRs declared"

		Print "Resolution:  Ensure that all clients have SVRs assigned."

		Exit Sub               

	End If

	email.SVRs = client.SVRs

	

	email.Principal = client.SendTo(0)

      'send a return receipt to the customer

	Call sendReturnReceipt(memo, client)

	email.tReturnReceipt = Now

	

	

	email.Save True, True

Call memo.Remove (True) -  Error message here

	Goto GetNextMemo

Else

           'memo is nothing so exit the sub

End If 

End Sub

Subject: RE: Doc not deleted by schedule agent (found problem)

What is the EXACT error msg?

Subject: RE: Doc not deleted by schedule agent (found problem)

from notes log : AMgr: Agent (‘Incoming’ in ‘APPS\PLS\PLSCERS.NSF’) error message: Notes error: You are not authorized to perform that operation

Subject: Doc not deleted by schedule agent

post your complete code if you want help