调用代理时如何在Xpages中传递文档上下文? [英] How to pass the Document context in Xpages while calling an Agent?

查看:63
本文介绍了调用代理时如何在Xpages中传递文档上下文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在调用Agent时在Xpages中传递Document上下文?在Xpage中,我需要从Xpage中调用带有documentcontext的Java代理,并且还需要将当前文档作为参数传递...

How to pass the Document context in Xpages while calling an Agent? In Xpage, I am in need of calling a java agent with documentcontext from my Xpage, And also I am in need of passing my current document as a parameter...

在Lotuscript中,我们可以轻松地做到这一点,而无需保存当前文档,但是在Xpage中,我正在使用以下代码.document1是当前文档.

In Lotuscript we can do it as easily without saving the current document, but in Xpage I am using the following code., document1 is a current document.

var agent=database.getAgent("AgentName");
agent.runWithDocumentContext(currentDocument.getDocument());

此代码我无法获取当前文档中项目的值,但是如果我将使用以下代码,

This code I am not able to get the values of my current document's items, but if I will use the following code,

var agent=database.getAgent("AgentName");
document1.save();
agent.runWithDocumentContext(currentDocument.getDocument());

我可以获取当前文档的项目值...但是我不想保存文档,而不保存文档,我需要获取item的项目值.

I can get the item value of the current document... But I do not want to save the document, without saving the document I need to get the item value of item.

请为此提供任何不错的解决方案...

Please give any nice solution for that...

推荐答案

agent.runWithDocumentContext(currentDocument.getDocument(true)).这会将所有新值放入后端文档中,因此其工作方式与Lotusscript相同.另外,如果您需要使用注释表格来计算当前文档,请将数据源的"computewithnotesform"属性设置为"onload"或"both".

agent.runWithDocumentContext(currentDocument.getDocument(true)). This will put all the new values inside the backend doc, so it works the same way as lotusscript does. Also, if you need to have the currentdocument computed with the notes form, set the 'computewithnotesform' property of the datasource to 'onload' or 'both'.

这篇关于调用代理时如何在Xpages中传递文档上下文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆