When I submit a form (an agent is run), the document created can immediately be seen in a view. But, when I search for the document using its unique number, it can't be found. So, I open the document from the view then save it (a different agent is run here). And voila! When I search for the number again the document now appears out of thin air!
I call db.updateftindex in both agents so I don't understand why the document only appears when the latter agent is run. I also tried running both agents when the document is submitted for the first time -- but it doesn't work!
Do you have any clue what's happening here? Any help will be appreciated.
It's hard to be sure without seeing the application, but the issue might be the unique ID that you are using for the search. When a document is first created, it gets a temporary UNID. Once the document is saved for the first time, the permanent UNID is set and will never change. If you're getting the UNID when the document is first created, then saving the form, you won't be able to find it by that UNID, because it will have changed. Any code that is triggered by the new document will not be able to get the permanent ID when the document is first saved.
I had a similar situation in an application one time, so I added a Computed when Composed field called InitialUNID to the form and set it to @Text(@DocumentUniqueID). I then created a lookup view by the InitialUNID field, so that I could immediately look up the document by that value from the same piece of code that initially saved it. In your situation, you should be able to full-text search for the value, because it will now be stored in a field on the document.
In my experience there are always a few minutes delay before the full text index are updated by the server.
If one wants to find a document by its UNID it is much quicker to just call
If the key is a field with an unique ID the best way to find the document is by using a hidden view sorted by the key. Remember to call view.refresh before view.GetDocumentByKey( key,True).
Do you have comments on this Ask the Expert question and response? Let us know.
Dig Deeper on Lotus Notes Domino Agents
Related Q&A from Brad Balassaitis
Upon moving to Lotus Notes 8, some Lotus Notes users received an error message stating: 'Database has not been opened yet.' Find out why here. Continue Reading
Discover what security settings you need to fix if you encounter the Lotus Notes database error: 'database is not opened yet.' Continue Reading
Learn the Formula language code that you can use if you'd like your Lotus Notes form with embedded views to stop displaying all response documents. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.