Agent that only works for me: permission issue?

Hi,

I have this mysterious permission 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 RunAgent on that(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)???. What this agent does is :read incoming mail, if matched a certain criteria, then read the body and pick out a date in it 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. Any suggestions or pointers are very much appreciated.

Many thanks in advance.

Subject: Agent that only works for me: permission issue??

Your subroutine ProcessAlert is saving the document in the database “16TA\BACA_TLog.nsf” on server “ABCX”.

Do they have the correct rights in this database?

Subject: RE: Agent that only works for me: permission issue??

Hi Matt,Oh my God! You are absolutely right! I just checked and my other team members only have Author access while I have Manager access. They should have Editor instead.

Thank you, thank you. You really make my day,Matt.

Subject: RE: Agent that only works for me: permission issue??

All applications should be qualified for certifiction under this program:

It’s making it work for other people that’s the problem :o)