Move files workflow

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2008 04:24 AM
Hi.
I need to create workflow which will be initiated with rules. Workflow simply needs to move document to another folder. I need little help. Here is what I have so far:
PROCESS DEF:
Rule script which i execute when file comes to folder:
When executed, i get:
I need to create workflow which will be initiated with rules. Workflow simply needs to move document to another folder. I need little help. Here is what I have so far:
MODEL:<model name="owf:MoveData" xmlns="http://www.alfresco.org/model/dictionary/1.0"><imports> <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/> <import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm"/> <import uri="www.alfresco.org/model/workflow/1.0" prefix="wf" /> <import uri="www.alfresco.org/model/content/1.0" prefix="cm" /></imports><namespaces> <namespace uri="oawf" prefix="owf"/> </namespaces><types> <type name="owf:startMove"> <parent>bpm:startTask</parent> <properties> <property name="owf:whereTo"> <title>Destination</title> <type>d:text</type> </property> </properties> </type></types></model>
PROCESS DEF:
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="owf:moveFiles"> <swimlane name="initiator"/> <start-state name="start"> <task name="owf:startMove" swimlane="initiator"/> <transition name="" to="end"> <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <runas>admin</runas> <script> var dest = companyhome.childByNamePath("Dest"); document.move(dest); </script> </action> </transition> </start-state><end-state name="end"/></process-definition>
Rule script which i execute when file comes to folder:
var workflow = actions.create("start-workflow"); workflow.parameters.workflowName = "jbpm$owf:moveFiles"; workflow.execute(document);
When executed, i get:
org.alfresco.scripts.ScriptException: Failed to execute script 'workspace://SpacesStore/a8a9950c-939c-11dd-9e2e-5be0a253008d': Failed to execute script 'workspace://SpacesStore/a8a9950c-939c-11dd-9e2e-5be0a253008d': Wrapped org.springframework.orm.hibernate3.HibernateSystemException: null index column for collection: org.jbpm.graph.def.ProcessDefinition.definitions; nested exception is org.hibernate.HibernateException: null index column for collection: org.jbpm.graph.def.ProcessDefinition.definitions (AlfrescoScript#3)
What am I doing wrong? Thanks
Labels:
- Labels:
-
Archive
4 REPLIES 4

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2008 06:41 AM
Solved problem from up there.. But still, i run this workflow, but script is not executed.. This should run and create/move/copy file, then end workflow..
What's wrong? Anybody?
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="cust:copyFiles">
<start-state name="start">
<transition name="" to="end">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<runas>admin</runas>
<script>
var dest = companyhome.childByNamePath("Reports");
var file = dest.createFile("itWorks.html");
file.save();
</script>
</action>
</transition>
</start-state>
<end-state name="end"/>
</process-definition>
What's wrong? Anybody?
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="cust:copyFiles">
<start-state name="start">
<transition name="" to="end">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<runas>admin</runas>
<script>
var dest = companyhome.childByNamePath("Reports");
var file = dest.createFile("itWorks.html");
file.save();
</script>
</action>
</transition>
</start-state>
<end-state name="end"/>
</process-definition>
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2008 08:47 AM
try this
<script> <variable name="companyhome" access="read" /> <expression> var dest = companyhome.childByNamePath("Reports"); var file = dest.createFile("itWorks.html"); </expression></script>
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2008 08:55 AM
And it might be silly, but you please make sure that "Reports" folder does exist in your company home
otherwise it will throw an error before creating the file.
Thanks,
Algoworks Alfresco Team
http://www.algoworks.com

Thanks,
Algoworks Alfresco Team
http://www.algoworks.com

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2008 04:37 AM
It worked at the end.. Could be I had some comments in script part of workflowprocess..
I realized script is not parsed with breaks (enters), so, if you put comments on the first line of your script, alfresco will recognize whole script as 1 line, which would be in comment in this case..
e.g.
Alfresco reads this as:
:lol:
I realized script is not parsed with breaks (enters), so, if you put comments on the first line of your script, alfresco will recognize whole script as 1 line, which would be in comment in this case..
e.g.
<script>//commentdo.something();</script>
Alfresco reads this as:
//comment do.something();
:lol:
