IBM ICN自定义插件实现点击自定义动作打开B类文档的步骤咨询
IBM ICN 自定义动作打开关联B类文档实现步骤
前置条件
你已经完成自定义动作注册、后台逻辑开发并成功获取目标B类文档的documentId,以下是剩余实现步骤:
步骤1:在自定义动作的JS模块头部引入ICN官方提供的依赖模块
示例代码:define([ "dojo/_base/declare", "ecm/actions/PluginAction", "ecm/actions/OpenDocumentAction", "ecm/model/ContentItem" ], function(declare, PluginAction, OpenDocumentAction, ContentItem) { return declare("YourPluginName.actions.ShowOtherDocumentAction", [PluginAction], { // 保留你的原有动作配置逻辑 performAction: function(repository, itemList, callback, teamspace, resultSet, parameterMap) { // 保留你原有调用后台服务获取B类documentId的逻辑 const targetDocId = "你从接口响应中拿到的B类文档documentId"; // 新增以下打开文档的逻辑 // 步骤2:用当前仓库实例获取目标B类文档的ContentItem对象 repository.retrieveItem(targetDocId, function(targetItem) { // 步骤3:实例化OpenDocumentAction并执行打开逻辑 const openAction = new OpenDocumentAction(); openAction.performAction(repository, [targetItem]); // 原有回调逻辑可根据需求保留 if (callback) callback(); }, function(error) { // 可选:添加文档查询失败的异常提示 ecm.widget.dialog.MessageDialog.showErrorMessage("关联文档查询失败:" + error.message); }); } }) })步骤4:更新插件配置并部署
确保你的插件入口Plugin.java中注册的自定义动作类指向你修改后的ShowOtherDocumentActionJS类,重新打包插件后上传到ICN管理控制台重启生效。
可选配置说明
- 如果需要强制在新窗口打开文档,实例化
OpenDocumentAction时添加参数:const openAction = new OpenDocumentAction({openInNewWindow: true}); - 如果目标B类文档存储在其他独立仓库,需要先通过
ecm.model.desktop.getRepositoryById("目标仓库ID")获取对应仓库实例,再执行retrieveItem方法。
内容的提问来源于stack exchange,提问作者Andrea Verdi
相关产品推荐
相关产品推荐

