Search code examples
xpagesxpages-ssjsagent

xpage button to run agent to save document


On an xpage web application the user only has public documents read access. I would like to find a way for the user to be able to save to a form. I guess the most secure way is by dooing this with an agent since I read somwhere that giving write access to public documents isn't secure.

Let's say I have 2 fields : firstname and lastname . Do I bind them to a scoped variable to have acces to them in the agent or is there a better way ?

How do I run the agent on a button click ? is following correct ? var agent:NotesAgent = database.getAgent("(register)");

How do I give the agent the necessary authority to save the document? And how do I get my data in my agent ? with for example sessionScope.firstName or is there a better way ?


Solution

  • The eventually smartest way: store that data into another database at all. XPages allows you to write to a different database. If the name shouldn't be visible for other public users, then use depositor as access level