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



Mar 22, 2011, 4:58 PM
5 Posts

Seems as Document is not updated

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.1
  • Role: Developer
  • Tags: SSJS xpages agent
  • Replies: 5
In a SSJS an LS-Agent (noteID as param) is called. This agent uses various LS-Functions to modify the passed document. The document is saved at the end of the agent
As far as i understood, the SSJS waits till the agent completes.

After calling the agent a value is read from the document.

var agent:NotesAgent = db.getAgent("agentName");
agent.run(nid);         // LS-Agent
readValueFromDoc(doc);    //SSJS Function in a ScriptLib -> read value X from document

The item is not available in the document! No matter if i recycle the doc and re-read it with database.getDocumentByUNID()....

Solution:
If i copy the document to the database via

var copyDoc:NotesDocument = doc.copyToDatabase(db);

the value can be read from the copyDoc.

The workaround does what it should, but I'm not happy with it....Any explanations or hints? Thanks
Mar 22, 2011, 11:42 PM
14 Posts
Re: Seems as Document is not updated
You still have memory copy of original document. After agent run, you have to get it again fresh from database:
var unid = doc.getDocumentUniversalID();
doc = db.getDocumentByUniversalID(unid);
 
This time you can read updates from agent.
Mar 23, 2011, 8:08 AM
5 Posts
Re: Seems as Document is not updated
I re-read the document in the ssjs after the agent has finished...
"...No matter if i recycle the doc and re-read it with database.getDocumentByUNID()...."
 
but no success.....
 
 
Mar 23, 2011, 8:29 AM
21 Posts
Re: Seems as Document is not updated
What is the actual code you are using to recycle?
 
Mar 23, 2011, 10:51 PM
5 Posts
Re: Seems as Document is not updated
 Hi Andrew, i used the following code to recycle and re-read the document
 
var docUNID:string = doc.getUniversalID();
doc.recycle();
var doc:NotesDocument = database.getDocumentByID(docUNID);
       
Apr 5, 2011, 10:44 AM
14 Posts
Re: Seems as Document is not updated
I doubt your code work. Note ID and Universal ID are two different attributes. getNoteID() -> getDocumentByID(), getUniversalID() -> getDocumentByUNID()...

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