This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal


May 9, 2017, 8:21 AM
11 Posts

Java agent doesn't save first document

  • Category: Application Development
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags: java
  • Replies: 9

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;
                    }

May 9, 2017, 9:00 AM
103 Posts
I could be blind but...

I don't see where you are assigning the document to userDoc...

Document userDoc = entry.getDocument();

May 9, 2017, 9:28 AM
11 Posts
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.

May 9, 2017, 11:33 AM
103 Posts
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.

May 9, 2017, 11:57 AM
11 Posts
Same error

Tried, the same situation. It doesn't saves the first document

May 9, 2017, 12:38 PM
103 Posts
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?

May 9, 2017, 7:55 PM
11 Posts
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.

May 9, 2017, 9:28 PM
326 Posts
Refresh

Did you by chance refresh the view manually or put in the code to refresh the view before getting the first document?

May 10, 2017, 1:18 PM
323 Posts
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?

May 12, 2017, 9:42 AM
11 Posts
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.


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal