Issue:
How to make a field's value be an Authors or Readers field.
Option 1:
Compute with form on save option in xpage/custom control properties.
Option 2:
Use the following server-side event code for the save/submit data's event of the xpage/custom control:
QuerySaveDocument event
(xpage --> events --> data):
var authors = new Array("[admin]","[staff]");
var doc:NotesDocument = myDataSource.getDocument(true)
var item:NotesItem = doc.replaceItemValue("authorfieldname", authors);
item.setAuthors(true);
myDataSource.replaceItemValue("authorfieldname",item);
myDataSource.save();
Notes:
- myDataSource is the data source name of the document/data source of the XPage.
- myDataSource.save() is especially required for unsaved documents, where doc.save() will cause an unexpected error: "No component found ... to handle the submit event".
previous page
|