Question about column formulas, getdocumentbykey and scheduled agents

This may be a daft question, but I’m having trouble with a scheduled agent and the getdocumentbykey method of the NotesView class, and I have a sneaky suspicion that my view is the cause.

basically here’s the setup…I have a hidden view called (User) that displays two sorted columns. The first sorted column displays the division the record has associated with. the second sorted column has a column formula in it that determines whether the user info associated with the document has a middle initial and based on that, will construct the column accordingly.

my question is this–do column formulas not resolve when the view is part of a scheduled agent? this agent was tested by me locally and worked fine, but when I debug it using the remote debugger, the view is set, i pass it the key array, but the document isn’t defined, even though I verified that both keys match and that both columns are sorted.

any info you may have would be greatly appreciated.

brandt

Subject: Question about column formulas, getdocumentbykey and scheduled agents

Welcome back Brandt. I think it has been a while since you have posted in the forum. Anyway, did you try refreshing the View using LotusScript, before making the call to the GetDocumentByKey method?

Subject: RE: Question about column formulas, getdocumentbykey and scheduled agents

Joydeep,

I’ve been busier than hell, which would explain my long absence from the forum.

Per your suggestion, I added a Call view.Refresh line to the script before I called getdocumentbykey. No dice. It still will not find the correct document.

Thanks for the response.

Brandt

Subject: RE: Question about column formulas, getdocumentbykey and scheduled agents

Just a thought: any chance the agent is set up to run under some authority that doesn’t have access to the document?

Subject: RE: Question about column formulas, getdocumentbykey and scheduled agents

The agent should be running with my authority and I have manager access to the db. The weird part is that it works when I run it locally, but not as a scheduled agent and there is no code that calls any sort of UI class. The GetDocumentByKey method simply isn’t returning the document when I feed it the keys, and all I can come up with is that the column formula must not be resolving for some reason…

Maybe I will create a field on the document that does what the column formula does and then feed that to view instead. But if anyone else has any insight, i’d very much like to hear it.

thanks for the response.

brandt

Subject: SOLVED: Question about column formulas, getdocumentbykey and scheduled agents

I was starting to write the agent I spoke about in my last post and was looking at the view that I was trying to match the keys with. I looked at the value of the user my script was bombing out on and noticed that his first name had an extra space in it, while my key did not. So basically the keys were not the same, and that’s why it crapped out on me.

sorry to waste everyone’s time. Time to go add some @Trims to that column formula…

Brandt