Folder/Space as Workflow Package
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2010 10:40 PM
I am wondering if there is a way to attach folder/space (along with the contents within) into a workflow package.
I know that to attach a node to the package we do something like:
var workflowPackage = workflow.createPackage();workflowPackage.addNode(node); // 'node' is the ScriptNode of the object (a document in this case).
But, that doesn't seem to work for folders? or does it??
Thanks

- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2010 06:16 AM
I also tried to add folders to workflow packages, but first you have to change all the backing beans of the workflow dialogs to make the folders be displayed in the Workflow Dialogs. Then you will realize that also the workflow dialog jsp pages have to be changed to display the folders correctly. Thats where I gave up.
Instead I allow the users to start a workflow on a folder. Then I made this folder the workflow package by overriding some code in StartWorkflowWizard.finishImpl()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2010 09:58 PM
Can you provide some information on how your workaround was achieved?
Where is the StartWorkflowWizard.finishImpl()?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2010 03:14 AM
<config> <actions> <action-group id="space_browse_menu"> <action idref="start_workflow" /> </action-group> </actions> </config>
into the <alfresco-config> element. If you restart Alfresco you should see the 'Start Advanced Workflow' option in the space browse menu.
Second, to make sure that the folder on which the user started the advanced workflow is taken as the workflow-package you have to change the class StartWorkflowWizard.java. To do this:
- Download the Alfresco SDK for your Alfresco distribution.
- In the SDK browse to src/web-client-src/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java
- Replace the following lines:
// create a workflow package for the attached items and add them NodeRef workflowPackage = this.getWorkflowService().createPackage(null);
with
// create a workflow package for the attached items and add them // hmedia: if the first package item is a folder, take this folder as the workflow package NodeRef nodeRef = new NodeRef(this.packageItemsToAdd.get(0)); QName type = getUnprotectedNodeService().getType(nodeRef); NodeRef workflowPackage; if (!getDictionaryService().isSubClass(type, ContentModel.TYPE_FOLDER)) workflowPackage= this.getWorkflowService().createPackage(null); else { workflowPackage= nodeRef; this.packageItemsToAdd.remove(0); }

After you did all this you can start an advanced workflow on a folder. In the Start Workflow Wizard you will not see the folder. This is because folders are not displayed in the workflow wizards. But as soon as you start the workflow and open the task you have assigned to a user this user will see the documents in the folder attached to the workflow.
Btw.: If you want to see the folder in the Start Workflow Wizard you would have to replace these lines of code in the StartWorkflowWizard init method:
if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT) || this.getDictionaryService().isSubClass(type, ApplicationModel.TYPE_FILELINK)) { this.packageItemsToAdd.add(itemToWorkflow.toString()); }
with these
// hmedia: added folder as content type if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT) || this.getDictionaryService().isSubClass(type, ApplicationModel.TYPE_FILELINK) || this.getDictionaryService().isSubClass(type, ContentModel.TYPE_FOLDER)) { this.packageItemsToAdd.add(itemToWorkflow.toString()); }
Good luck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2010 06:55 PM
I would have thought this would be something that is out of the box from Alfresco. 😕
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2010 10:19 AM
Btw.: I realized that if more than one workflow is started on the same folder then you will have error messages to delete the previous workflows. Only the latest workflow can be deleted. So you have to make sure that only one workflow can be started on the folder.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2010 02:11 AM
Is there any other way out to start workflow on folders using the existing Javascript APIs, And how to deal with this repeated errors that crop in due to application of multiple workflows on a single folder??
thanks in advance
padmalaya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2010 02:39 AM
I'm not sure about starting a workflow on a folder using the Javascript API. Could be possible. Don't know.
It turned out that the problem I had was not related to multiple workflows on a folder but to https://issues.alfresco.com/jira/browse/ALF-2764
and http://issues.alfresco.com/jira/browse/ETWOONE-306. I had two loops in my workflow and that causes Alfresco to crash if I wanted to cancel the workflow.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2010 03:09 AM
Thanks for the "fast" reply, wasnt expecting though

However, does the above solution mentioned by you work(by changing the code in jave files)??
I tried the same , but at one point I gt errors in the build , at the second try it dint reflect in the UI itself.
Kinda stuck in it!!
Thanks ,
Padmalaya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2010 03:18 AM
