获取工作流任务Alfresco的NodeRef [英] Get NodeRef of a workflow task Alfresco

查看:123
本文介绍了获取工作流任务Alfresco的NodeRef的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个工作流程,然后转到任务编辑页面:



我是尝试获取工作流任务的文件(latexexemplo-2.pdf)的nodeRef:



I create a workflow, and when I go to the task-edit page:

I'm trying to obtain the nodeRef of the file (latexexemplo-2.pdf) of the workflow task:

http://localhost:8080/share/page/task-edit?taskId=activiti$20649

I'm trying to make this way:

var taskId = args.taskId
var task = workflow.getTaskById(taskId);
nodeRef = task.getPackageResources()[0].nodeRef;

But I obtain "args is not defined" ... "workflow is not defined" ... "task is not defined".

How can I get the nodeRef with another way?

解决方案

Unfortunately, you cannot access in the browser information that is in the repository.

A quick and dirty solution is to use directly the information that is already in the page.

I have started a workflow and opened the task page as you did. Using the browser debug tool, I have inspected the html. As you can see in the image attached below, Alfresco stores the documents attached to the task in an hidden input. You could use YAHOO to get it.

Search for an element with the id "page_x002e_data-form_x002e_task-edit_x0023_default_assoc_packageItems". If there is more than one document associated, the value will be a comma separated list of noderefs. I am getting the first element. This of course works, as is, only if there is one and only one document associated. You should probably take into account also the case when no document is associated or there is more than one.

var nodeRef = YAHOO.util.Selector.query("#page_x002e_data-form_x002e_task-edit_x0023_default_assoc_packageItems")[0].value;

这篇关于获取工作流任务Alfresco的NodeRef的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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