Last week, I was helping the fresh recruits find their way in a mini project that they were doing in XPages. This project had a work flow and the newbies were struggling to understand how to get the same document to be seen and approved by an ASM and then by an RSM. The condition being that after the ASM had approved it, he could only read the document while RSM could read and make changes to the document. This involved setting Authors and Readers fields which was easy while using the Notes Form, but in XPages, since we do not have a Readers or Authors field type, we need to necessarily set the Authors/Readers field property for the text entered into the Edit box. (If we do not want to use the computeWithForm property in XPages which would hit on the performance speed).

To ensure this I asked them to do the following

  • Create an authorField and readerField in the Xpage.
  • During QuerySave, compute the values for Readers/Authors field.
  • Save the document.
  • During PostSave, call the function given below to set property for Readers/Authors field.

 function setupAuthorReaderFields(doc, authorField, readerField)


var authitem:NotesItem = doc.getFirstItem(authorField);
// Set property to authors if the authorField item has not been setup as an “Authors” type field initially
var readitem:NotesItem = doc.getFirstItem(readerField);
// Set property to Readers if the readerField item has not been setup as an “Readers” type field initially
//Save Document;
return e.message
functionName=”setupAuthorReaderFields “;
severity=”high”; //or Medium, low
log.logError(e.message, severity, ”, ”,
view.getPageName(), functionName);