本文介绍了获取工作流任务 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:

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 21:24
查看更多