[SOLVED] Workflow without a document?!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 08:37 AM
I managed to make advanced workflow using jBPM and i made a custom screen for every node of my workflow. That all works fine for me.
Now I would like to start a workflow without a document. What I mean is that a user clicks on a menu item which will say i.e. "Start a workflow" and then i would love to show some screen in which will user insert some additional information like:
- Type of document (predefined)
- Some custom aspects
After insert of this data I need that my workflow create a document (or more documents) and start the workflow for it.
Is it possible and how?! Please if someone have some suggestion let me know.
p.s. I've searched this forum for a while before posting this thread.
Thanks in advance
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 09:19 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 10:16 AM
Solution : have a look at the webclient-config-workflow-actions.xml
See the param tag I commented.
Write it in your webclient-config-custom.xml
<actions> <action id="start_workflow"> <label-id>start_workflow</label-id> <image>/images/icons/new_workflow.gif</image> <evaluator>org.alfresco.web.action.evaluator.StartWorkflowEvaluator</evaluator> <action>wizard:startWorkflow</action> <action-listener>#{WizardManager.setupParameters}</action-listener> <params> <!– <param name="item-to-workflow">#{actionContext.id}</param> –> </params> </action>
In this very webclient-config-custom.xml, you will find how to place the icon (of this action) wherever you want.
2/ Create the document programmatically
In order to do that, You will surely have to override the StartWorkflowAction.java, get a look at the foundation services in order to create and manipulate documents.
If you wish to, let's keep this topic alive, because I'll soon have to achieve the same thing :
1/ Bypass the first step of the workflow wizard : the type of workflow will have to be automatically selected, depending on the type of document that triggered the action
2/ Have this workflow's package hold no document at first
3/ Create and manipulate a new document that will be attached to the process
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 08:12 AM
1/ Starting advanced workflow does not attach any document to the process
In order to do that, You will surely have to override the StartWorkflowAction.java, get a look at the foundation services in order to create and manipulate documents.
If you wish to, let's keep this topic alive, because I'll soon have to achieve the same thing :
1/ Bypass the first step of the workflow wizard : the type of workflow will have to be automatically selected, depending on the type of document that triggered the action
2/ Have this workflow's package hold no document at first
3/ Create and manipulate a new document that will be attached to the process
Actually I am now on phase 3/ and currently I have a problem how to attach new document to the proccess?!
In my transition i used script sown bellow
<transition to="node1" name="test_transition">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
var dest = companyhome.childByNamePath("User Homes");
var file = dest.createFile("file_name");
file.save();
</script>
</action>
</transition>
How can I attach my new created file to the process?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 08:46 AM

Maybe this will work :
bpm_package.children[0] = file;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 09:43 AM
You have to add it to the bpmackage
Maybe this will work :
bpm_package.children[0] = file;
Hm… This didn't work out for me

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 09:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 11:26 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 11:34 AM
<transition name="" to="end1"> <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> <variable name="bpm_package" access="read, write" /> <expression> var dest = companyhome.childByNamePath("User Homes");var file = dest.createFile("file_name");file.save(); bpm_package.children[0]=file; </expression> </script> </action> </transition>
And add this line to the end of your log4j.properties file
log4j.logger.org.alfresco.repo.jscript=debug
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2009 06:55 AM
Caused by: org.jbpm.graph.def.DelegationException: Failed to execute supplied script: ReferenceError: "companyhome" is not defined. (AlfrescoScript#1)
at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:387)
at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:378)
at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:281)
at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:220)
at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:190)
at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:174)
at org.jbpm.graph.def.Transition.take(Transition.java:138)
at org.jbpm.graph.def.Node.leave(Node.java:394)
at org.jbpm.graph.node.StartState.leave(StartState.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$ea416026.leave(<generated>)
at org.jbpm.graph.exe.Token.signal(Token.java:195)
at org.jbpm.graph.exe.Token.signal(Token.java:140)
at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:485)
at org.alfresco.repo.workflow.jbpm.WorkflowTaskInstance.end(WorkflowTaskInstance.java:133)
at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:399)
at org.alfresco.repo.workflow.jbpm.JBPMEngine$26.doInJbpm(JBPMEngine.java:1693)
at org.springmodules.workflow.jbpm31.JbpmTemplate$1.doInHibernate(JbpmTemplate.java:87)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:338)
at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:80)
at org.alfresco.repo.workflow.jbpm.JBPMEngine.endTask(JBPMEngine.java:1670)
… 54 more
