How can i add Authors-field to a document created through xpage?All i want is to add a new field containing [USER] -role and current user’s name to authors-type of field.
Now author-level users can only create documents but they cannot modify them.
How can i add Authors-field to a document created through xpage?All i want is to add a new field containing [USER] -role and current user’s name to authors-type of field.
Now author-level users can only create documents but they cannot modify them.
Subject: Use a ‘postNewDocument’ event…
On the XPage or Custom Control, go to the document’s data source Events tab.
Then select the postNewDocument event under data.
Then select the Add action to add a simple action for this event. From the dialog select All from Category and Set Value from Action.
Then add ‘dominoDocument1.From’ computed value for Binding in expression lanuage - (dominoDocument1 is your data source and From is your authors field in that Form from which the data source is set to )
And then add ‘@UserName()’ as a computed value to Value
and your done.
<xp:dominoDocument var="dominoDocument1"
formName="xspEditBox">
<xp:this.postNewDocument>
<xp:setValue binding="#{dominoDocument1.From}"
value="#{javascript:@UserName()}">
</xp:setValue>
</xp:this.postNewDocument>
</xp:dominoDocument>
Subject: Use the computeWithForm.
Setup the authors field on the Form that the xPage is using as its Data Source.
Then on the xPage goto “All Properties” Tab, then expand data, then expand data, then expand dominoDocument [0] (This is what ever you set it up as)
Under here you will see the Property “computeWithForm” Set it to onsave.
That is it.
Or you could edit the source for the xPage and add:
<xp:dominoDocument var="dominoDoc" formName="yourFormName"
computeWithForm="onsave" action="openDocument">
</xp:dominoDocument>
</xp:this.data>