Ric*_*mar 2 lotusscript xpages
我在Agent中编写了lotusscript代码,我需要通过单击Xpage中的按钮来运行代理.
我怎么能实现?
提前致谢
此解决方案的一个问题可能是,当您要使用在代理中操作的数据时,您必须在xpage中重新加载notes文档.这可以通过以下代码行完成:
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?
}
Run Code Online (Sandbox Code Playgroud)
从版本8.5.2开始,代理类中添加了一个新方法
agent.runWithDocumentContext(NotesDocument doc);
此方法使用xPage的内存文档.因此,您无需在代理本身中保存文档,但可以进行更改并退出代理代码.xpage可以直接利用所做的更改.通过检查代理是否完成了工作,重新加载文档等,这可以省去很多麻烦.
为此,您必须将代理的选项设置为
只需在点击事件上调用它(代理使用的语言没有区别)
database.getAgent("agentName").run() or database.getAgent("agentName").runOnServer()
Run Code Online (Sandbox Code Playgroud)
请注意,代理的运行时必须是这样的

| 归档时间: |
|
| 查看次数: |
6534 次 |
| 最近记录: |