cancel
Showing results for 
Search instead for 
Did you mean: 

Get Document informations for workflow instance

crono40
Champ on-the-rise
Champ on-the-rise
Hello,

I created a new page in order to display all actives workflows for all the users. For this, I call the following URL :

http://127.0.0.1:8080/share/proxy/alfresco/api/workflow-instances?skipCount=0

Next and for each result of the previous request, I call the the following URL to get related tasks to the workflow :

http://127.0.0.1:8080/share/proxy/alfresco/api/workflow-instances/activiti$id?includeTasks=true

But i can't get the related document which is linked to the workflow. I need the node Ref to create a link to the document.

Could anyone help ?

Thanks a lot.
5 REPLIES 5

kaynezhang
World-Class Innovator
World-Class Innovator
The json response from http://127.0.0.1:8080/share/proxy/alfresco/api/workflow-instances/activiti$id?includeTasks=true already contains workflow  package node Ref
the jso response will be something like below,<strong>  "package": "workspace://SpacesStore/3e26a802-06b1-4e43-80a9-7e1bdf559e29"</strong> is workflow related document node ref.

{
   "data":
{
   "id": "activiti$201",
   "url": "api/workflow-instances/activiti$201",
   "name": "activiti$activitiInvitationNominated",
   "title": "\u7ad9\u70b9\u9080\u8bf7 - \u63a8\u8350\u5f0f",
   "description": "\u7531\u7ad9\u70b9\u7ba1\u7406\u5458\u63a8\u8350\u7684\uff0c\u5bf9 Share \u7ad9\u70b9\u7684\u9080\u8bf7",
   "isActive": true,
   "startDate": "2013-08-17T14:47:23.000+08:00",
   "priority": 2,
   "message": "kayne163 \u7ad9\u70b9\u7684\u52a0\u5165\u9080\u8bf7",
   "endDate": null,
   "dueDate": null,
   "context": null,
   "package": "workspace://SpacesStore/3e26a802-06b1-4e43-80a9-7e1bdf559e29",
….

crono40
Champ on-the-rise
Champ on-the-rise
Hello kaynezhang,

Firstly, thanks for your reply. Effectively, i can get the workflow package node ref thanks to the package attribute of the request.

However, it's the node of the package and not the node document. So when i want to build a link like :
http://<IP SERVER>:<PORT>/share/page/document-details?nodeRef=workspace://SpacesStore/3e26a802-06b1-4e43-80a9-7e1bdf559e29 (i took your example)

I've got an error message telling that the document does not have any content. Do you have a solution ?

Thanks.

kaynezhang
World-Class Innovator
World-Class Innovator
Workflow package is a folder not a document.
All documents and folder associated with the workflow are saved in this folder.

hita
Champ in-the-making
Champ in-the-making
Hi crono04,
I've just bumped into the same problems as you.
Have you found out solutions for yours?
I've tried kaynezhang solutions. But the workflow package is empty. I wonder why.
My task detail screen is attached below.

crono40
Champ on-the-rise
Champ on-the-rise
Yes I found something. You have to use the package attribute returned with this URL :
http://127.0.0.1:8080/share/proxy/alfresco/api/workflow-instances?skipCount=0

With this, you call this URL :
http://208.0.211.116:8080/share/proxy/alfresco/slingshot/node/workspace/SpacesStore/#YourPackageNumb...

It will returned a JSON containing a children attribute. It's an array containing all the documents of the workflow. For each element, you have the name of the doc (children.name) and the node ref of the document (children.nodeRef). You create the link with this.

Hope it will help.