I am running a scheduled agent that looks for a field value in a profile document to see whether it should continue to run ie if value=“Y” then run. I want it to set the value back to “N” if it was “Y”.
Subject: Cant save profile document in scheduled agent
maybe a silly suggestion but is the profiledoc your are opening in the GUI the same as the one in your script?Sometimes due to some screwup you end up with two profile documents with the same name in the database.
Or are you using a username to open the profdoc and are they different?
Subject: RE: Cant save profile document in scheduled agent
I decided I’d try deleting the profile doc.
Set col = db.GetProfileDocCollection(“f-configProfile”)
Call col.RemoveAll(True)
There was one found in the collection which got deleted (I ran in degug mode to see it happen).
Then I went in with the GUI to create the new profile doc, but found that the values were already set. So had a look at the doc properties and found it was created over a week ago. The doc has some extra fields making it look like a conflict of some kind. And it doesn’t get deleted by my code so how do I delete it?
Subject: RE: Cant save profile document in scheduled agent
managed to delete the other profile this way cause it didn’t get found by getprofilecollection.
Set db = s.CurrentDatabase
Set doc = db.GetProfileDocument(“f-configProfile”)
Call doc.Remove(True)
It gave me the reb box of death and crashed notes in the process >:(
So I then recreated the profile doc in the GUI and set my scheduled agent to run again. And it still won’t update the field. has anyone ever had similar thing happen? Arrrrggghhh!!!
Subject: RE: Cant save profile document in scheduled agent
Okay I created a simple agent that updates a field in the profile doc. I works properly when I run it manually. But If I change it to scheduled it doesn’t do it.
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim col As NotesDocumentCollection
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set doc = db.GetProfileDocument("f-configProfile")
doc.RunRetention = "N"
Call doc.Save(True,False)
End Sub
Is there a reason why this wouldn’t work when run as a scheduled agent?
Profile docs get cached on the client while the database is open and only get updated from the database when you close the database and open it again (from the designer help). Although it actually only updated for me when I fully closed down Notes and opened it back up again.
I can live with this because the profile doc won’t need to be changed much. My confusion was I was going into the profile doc as soon as the agent had run cause I’m testing stuff. But normally this would only need to be done every couple of weeks.
Subject: RE: Found an answer to profile docs problem
they do get cached on the web but I have never had them cache in the client. I have worked successfully with profile docs for sequential numbering etc with no caching happening!
Subject: RE: Found an answer to profile docs problem
They do get cached in the client. You just have not seen any negitive results. Probably just do to luck. I suggest you change your sequential numbering method before you run into trouble.
Subject: RE: Found an answer to profile docs problem
Your application may run fine for another seven years, if only one user/agent is using the profile’s data at the same time (since caching has no negative effect then).
But you WILL ran into problems if more than one user/agent is updating the profile document.