XPages creating author and reader fields

I have a querySaveDocument function for my xPage where I set some external fields, including the Authors and Readers fields.

var authors = new Array("[AdminEditors]"); var user:String=session.getEffectiveUserName(); authors.push( user ); var authitem:NotesItem = doc.replaceItemValue("z_Authors", authors ); authitem.setAuthors(true); var readitem:NotesItem = doc.replaceItemValue("z_Readers", "[AdminReaders]" ); readitem.setReaders(true); 

I thought doc.replaceItemValue () would return a reference to NotesItem, but authItem is null.

So, how to create a field in the Notes Document Form using SSJS and get a link to it?

Thanks,

- Jeff

+7
source share
1 answer

Be sure to use getDocument (true) to synchronize the source document with the changes made to the external document.

 var doc = document1.getDocument(true); 
+9
source

All Articles