0

我正在使用公式代码调用 Java 代理:

@Command([RunAgent]; "My Agent");

代理运行并正确读取其参数。当代理仍在运行时,某些文档可能会更改。代理看不到更改并继续读取旧值。具体来说,处理可能会被取消,所以我试图告诉我的代理停止。我通过更改我专门用于将参数传递给代理的文档中的值来做到这一点:

Call doc.ReplaceItemValue("Pause","True")
Call doc.Save(True, False)

这就是代理的作用:

 Session session = getSession();
 AgentContext agentContext = session.getAgentContext();
 Database db = agentContext.getCurrentDatabase();
'Reload the document with the parameters
 paramDoc = db.getDocumentByID(paramDoc.getNoteID());

但是代理只看到默认值。它似乎有一个数据库的图像,就像它在调用它时一样。

关于如何通知代理有关新值或暂停/取消其线程的任何线索?

4

2 回答 2

2

为了读取当前值(丢弃缓存),请使用:

noteid = paramDoc.getNoteID()
Delete paramDoc
paramDoc = db.getDocumentByID(noteid);

好吧,这是针对 LotusScript 的——您在代理中使用 Java。所以我想它会是(编辑以包括 nempoBu4 提出的澄清):

String noteid = paramDoc.getNoteID();
paramDoc.recycle();
paramDoc = db.getDocumentByID(noteid);
//Check the new value
于 2014-07-26T08:13:44.300 回答
0

查看 NotesDocument 类的 Refresh 方法。您需要在检查代理中的值之前调用它,以获取任何更新的值。

于 2014-07-26T01:45:09.163 回答