2012-11-05 57 views

回答

9

此解决方案的问题可能是,当您想要使用代理中操作的数据时,您必须在xpage中重新加载注释文档。这可以用下面的代码行来完成:

 var ag = database.getAgent("agentname"); 
    if(ag != null){ 
     var id = doc.noteid; 
     ag.runonserver(id); 
     doc.recycle(); 
     doc = database.getdocumentbyid(id); 
     // check if the agent did its job. 
     // if so do stuff otherwhise report this to the user? 
    } 

由于8.5.2版本有一个新的方法加入到该代理类

agent.runWithDocumentContext(NotesDocument的DOC);

此方法使用xPage的内存文档。因此,您不需要将文档保存在代理本身中,但可以进行更改并退出代理代码。 xpage可以直接使用所做的更改。这样可以节省你很多的麻烦与检查,如果代理做他的工作,重新加载文档等等等等

对于这个工作你有你的代理的选项设置为

  1. 运行的Web用户
  2. 允许受限制的操作
  3. 剂的类型是“代理列表选择”目标与“无”
8

只需拨打该上点击事件(是没有区别的使用何种语言剂)

database.getAgent("agentName").run() or database.getAgent("agentName").runOnServer() 

通知,运行时间为代理人必须是这样的 enter image description here