MarisP
MarisP

Reputation: 987

Tracking document content changes

I'm trying to track the history of field values that are displayed in computed field as HTML. So far I got this:

var x = document1.getItemValue("category");

var html = "<table>";

for (i = 0 ; i < x.size(); i++){
    html= html + "<tr><td>" + x +  "</td></tr>";
    html = html + "<tr><td>" + session.getEffectiveUserName() + "</td></tr>";
    }
html = html + "</table>";

The code works ok, I get the value that I need and it gets displayed and if I edit the current document, the value changes via partial update that I have attached to the save button, but that's not the problem. The problem that I have is with saving it. I thought of creating an array and adding the value that changed but it will reset everything because of the script. Any suggestions how I can save that value or add it to the field? I was using Append ToTextList in forms, is there any way how to achieve that functionality in Xpages?

Upvotes: 1

Views: 157

Answers (2)

David Leedy
David Leedy

Reputation: 3593

Chris Toohey just posted a blog article that seems to be what you're looking for.

http://www.dominoguru.com/page.xsp?id=thoughts_on_future_proofing_notesdata_for_application_development.html

Upvotes: 0

Txemanu
Txemanu

Reputation: 449

You can add a new value in a field in the querySave of the DominoDocument in XPages:

var x = document1.getItemValue("category");
x.add(myNewValue);
document1.replaceItemValue("category", x);

Upvotes: 2

Related Questions