Hi,
I have a Notes db with a Java agent which is modifying all documents in the view. Instead the first one. It seams, that the doc.Save(true, false) doesn’t work. I can get any information from the document, so the doc has value, if I modify any value on the doc and than check the value, it was modified, but it doesn’t saved. I tried to modify the order of the documents in the view, in this case the first document wasn’t updated again, so it is independent of which document is the first.
Here is the code:
ViewEntry entry = viewColl.getFirstEntry();
Document userDoc;
ViewEntry tempentry;
while (entry != null) {
userDoc = entry.getDocument();
System.out.println(userDoc.getItemValueString(“Name”));
userDoc.replaceItemValue(“referralPdfDate”, session.createDateTime(new Date()));
userDoc.save(true, false);
System.out.println(“Saved” );
tempentry = viewColl.getNextEntry(entry);
userDoc.recycle();
entry.recycle();
entry = tempentry;
}
Subject: Refresh
Did you by chance refresh the view manually or put in the code to refresh the view before getting the first document?
Subject: Same error
Tried, the same situation. It doesn’t saves the first document
Subject: I could be blind but…
I don’t see where you are assigning the document to userDoc…
Document userDoc = entry.getDocument();
Subject: The error was on other part
Hi All,
Thank you for answers, it seams, that the error was on an other code part. The Java agent was started from a LS and there was a global variant which made the error.
Subject: Cannot be access problem
There are not reader fields, I have manager access, the agent is started from client. The strange thing is, that if I create a copy from the document using Ctrl+C and Ctlr +V, the second document is processed. If I change the document order (for example, rename the user) and the document no longer “the first doc in view” the agent is running well. Only the first document of the view is not saved.
I tried to get only the first document but no success.
Subject: cool…
Is the agent run from the UI or the backend?
You could try the View class getFirstDocument and getNextDocument methods and see if you get the same result.
Subject: First things, first.
1- Was the document retrieved? When you run it through the debugger, did the document come up in the view entry collection?
2- I assume this is a ViewEntryCollection object you’re processing. How did you retrieve the nvec? And does the view have subcategories?
Subject: corrected
Sorry, I removed some rows from the code which were not relevant, and it seams, that I removed the userDoc setting too. I added to the code.
Subject: UI or backend?
Is the agent run from the user interface or is it a backend agent?
Are there any Readers/Author fields on the doc?
Can you manually edit the document?