Shared agent that only works for me

Hi,

I have this mysterious problem: As a team we have a project mail database that we all share (everyone has Manager access). I created an agent “After new mail has arrived”. It works fine if I create an action button to RunAgent(I will ask the question about why this On Event agent does not work for after-new-mail on another thread) . It works fine for me. But for all other team members it bombs out at : Call TLogdoc.Save(True, True)???. The agent read incoming mail, if matched a certain criteria, then read the body and pick out a date then insert that date into another form.

Here is the code : It has a

  1. Sub Initialize : to setup search criteria.

If found then call

2)Sub ProcessAlert:

a) call 3) Sub GetInfo to read mail body to find the X date,

b) insert the date into another form then save it(where error occurs for other team members).


Sub Initialize

'Search for Alert about store close 

Set session = New NotesSession

Set db = session.CurrentDatabase

Set dc = db.UnprocessedDocuments



Set memoform = New NotesDocument(db)

'Search for mail with subjec = "Store Alert:"

If dc.Count>0 Then        

	Set doc = dc.GetFirstDocument

	For i=1 To dc.Count

		

		Fromtemp = "Store"

		Subject = doc.Subject(0)   

		formName = doc.Form(0)

		FromSender = doc.From(0)

		

		SearchforString1= "Store Alert: StoreGazer"

		SearchforString2= "posted a ABC at"

		

		positionOfFrom = Instr(FromSender$, Fromtemp$)

		positionOfString1= Instr(Subject$ , SearchforString1$ )

		positionOfString2= Instr(Subject$ , SearchforString2$ )

			

		TLogSubject  = "store closeout completed"

		TLogSubjectPos = Instr(Subject$, TLogSubject)

		TLogFrom = "StoreHelp/Houston/XXX@XXXUS"

								If Not doc.HasItem("Processed") Then

			If (positionOfString1 <>0) And (positionOfString2 <> 0) And formName = "Memo"  And (positionOfFrom<>0)  Then

				

				Call ProcessAlert

				

		    								End If

			doc.Processed = "1"

			Call session.UpdateProcessedDoc( doc )

		End If

		

		Set doc = dc.GetNextDocument(doc)

	Next

	Call dc.UpdateAll

End If

End Sub


Sub ProcessAlert

On Error Goto Somethingwrong



Call GetXInfo



	Dim dbDeCA As New NotesDatabase( "ABCX", "16TA\\BACA_TLog.nsf" )

Dim ByKeyView As NotesView

Dim TLogDoc As NotesDocument



Dim keys (1 To 2) As Variant

keys(1) = XDateOnly                      'Search for date first

keys(2) = StoreID                                     'then search for StoreID



Set ByKeyView = dbDeCA.GetView( "GetDocByKey" )

Set TLogDoc = ByKeyView.GetDocumentByKey(keys)



If Not (TLogDoc Is Nothing) Then

	TLogDoc.XDate = XDate

	Call TLogDoc.Save(True,True) ' <--- This is where error is

End If



Exit Sub

Somethingwrong:

Msgbox "Something wrong on ProcessXAlert"

End Sub


Sub GetXInfo

Dim S1 As String

Dim S2 As String

Dim XstoreID As String

Dim FromID As String

'Get the StoreID from the doc.From(0) field

FromID = doc.From(0)

S1 = Strleft(FromID,"@")   'StoreXXXX

StoreID = Cint(Strright(S1,"e"))



Set body = doc.GetFirstItem("Body")

 REM Find line started with "Datetime" in Body item

Set rtnav = body.CreateNavigator

Set rtrange = body.CreateRange

searchString$ = "Datetime"



If rtnav.FindFirstString(searchString$, RT_FIND_CASEINSENSITIVE) Then

	Call rtrange.SetBegin(rtnav)

	X1date = rtrange.TextRun

	XDate= Cdat(Strright(X1date,"    "))

	XDateOnly = Datevalue(XDate) 	

Else

	Messagebox searchString$,, "Cannot find X Date"

	Exit Sub

End If

End Sub


Variables are declared in Declaration.

I ran in Debug Mode and found out that everyone else got error when it get to : Call TLogDoc.Save(True, True) on Sub ProcessAlert ???

I suspect it is some kind of permission issue but don’t know where to look for that. I added the :

AMgr_DisableMailLookup= 1

on the notes.ini on my machine and one team member machine but that does not solve the problem.

Help please.

Many thanks in advance.

Subject: RE: Shared agent that only works for me

I hate, hate, hate it when someone says they get an error and doesn’t say what the error is.

If, as you say, everybody has Manager access, then I don’t see what kind of access problem they might have in editing an existing document. Can they edit the document manually? Does the access icon on the statusbar show they are managers when they are in the database?

Subject: Shared agent that only works for the designer???

It must be some kind of permission issue. Please help!!!