I have created an xpages where I select documents in a view so I can update a number of fields on them.
- server side script with full update works fine using this code in a button.
var view = getComponent("viewPanel4");
var doccol = view.getSelectedIds();
for (i=0; i < doccol.length; i++){
var docid = doccol[i];
if (docid != null) {
var doc:NotesDocument = database.getDocumentByID(docid);
doc.replaceItemValue("assignTo","Joe Blow");
doc.replaceItemValue("assignCompany","JB Plumbing");
doc.save(true);
}
}
But I want the value that I'm updating to come from a dialogbox So I can prompt the user to select who the records are assigned to.
The dialogbox come up and works fine. I set a bunch of viewscope variables to store the values but the values don't get added to the documents that I have selected in the view.
var d = getComponent('dialog1')
d.show()
To close the dialogbox and set the fields I am having a problem.
var view = getComponent("viewPanel4");
var doccol = view.getSelectedIds();
for (i=0; i < doccol.length; i++){
var docid = doccol[i];
if (docid != null) {
var doc:NotesDocument = database.getDocumentByID(docid);
doc.replaceItemValue("assignTo",viewScope.get("dlgAssignedTo");
doc.replaceItemValue("assignCompany",viewScope.get("dlgAssignCompany");
doc.save(true);
}
}
var c = getComponent("dialog1")
c.hide("viewPanel4")
I'm sure I'm missing something pretty simple but I don't know why as soon as I add the dialog in the mix the records no longer update. I've tried setting them with a straight string doc.replaceItemValue("assignTo","Joe Blow");
doc.replaceItemValue("assignCompany","JB Plumbing");
but that isn't working so I don't think it has anything to do with the session variables.
Any suggestions Please
Thanks