cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow to space

alexey
Champ in-the-making
Champ in-the-making
Hello.
I have a question. How can i start workflow using a some space as the workflow resource?
Thanks.
14 REPLIES 14

harishns
Champ in-the-making
Champ in-the-making
Hi,
I found workflow menu item for a space and I have used Parallel review workflow.
The assignment is not throwing any error  but when I approve I am getting following error

"A system error happened during the operation: 09020009 Failed to signal transition 'approve' from workflow task"
I am trying to move approved space to different location . my processes definition is as follows 
        . . .
        <transition name="approve" to="approved">
            <condition>#{wf_actualPercent >= 30}</condition>
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
          <runas>admin</runas>
          <script>   
            var dest= companyhome.childByNamePath("Approved");
              bpm_package.children[0].move(dest);   
          </script>
           </action>
        </transition>
        . . .
I am able to initiate same workflow using scripts via rule with following code.

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wfSmiley Tonguearallelgroupreview";
workflow.parameters.requiredApprovePercent = 20;
workflow.parameters["bpm:workflowDescription"] = "Please review and approve: " + document.name;
workflow.parameters["bpm:groupAssignee"] = people.getGroup("GROUP_engineering");
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 7);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.execute(document);

I am trying this because I want to add reviewers from UI

Please help me
Thanks in advance

jayjayecl
Confirmed Champ
Confirmed Champ
Hi

you'll have to give us the full logs of the error.

thank you

harishns
Champ in-the-making
Champ in-the-making
Hi,
Here is more details on log file
   at java.lang.Thread.run(Thread.java:595)
Caused by: org.jbpm.graph.def.DelegationException: 09020003 Failed to execute supplied script: 09020002 TypeError: Cannot call method "move" of undefined (AlfrescoJS#1)
   at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:388)
   at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:379)
   at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:301)
   at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:241)
   at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:213)
   at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:196)
   at org.jbpm.graph.def.Transition.take(Transition.java:152)
   at org.jbpm.graph.def.Node.leave(Node.java:479)
   at org.jbpm.graph.exe.ExecutionContext.leaveNode(ExecutionContext.java:155)
   at org.jbpm.graph.node.Decision.execute(Decision.java:194)
   at org.jbpm.graph.def.Node.enter(Node.java:390)
   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:585)
   at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
   at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$88ce3ff5.enter(<generated>)
   at org.jbpm.graph.def.Transition.take(Transition.java:167)
   at org.jbpm.graph.def.Node.leave(Node.java:479)
   at org.jbpm.graph.def.Node.leave(Node.java:438)
   at org.jbpm.graph.node.Join.execute(Join.java:201)
   at org.jbpm.graph.def.Node.enter(Node.java:390)
   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:585)
   at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
   at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$88ce3ff5.enter(<generated>)
   at org.jbpm.graph.def.Transition.take(Transition.java:167)
   at org.jbpm.graph.def.Node.leave(Node.java:479)
   at org.jbpm.graph.node.TaskNode.leave(TaskNode.java:213)
   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:585)
   at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
   at org.jbpm.graph.node.TaskNode$$EnhancerByCGLIB$$c314363f.leave(<generated>)
   at org.jbpm.graph.exe.Token.signal(Token.java:223)
   at org.jbpm.graph.exe.Token.signal(Token.java:188)
   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:585)
   at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
   at org.jbpm.graph.exe.Token$$EnhancerByCGLIB$$355ce689.signal(<generated>)
   at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:495)
   at org.alfresco.repo.workflow.jbpm.WorkflowTaskInstance.end(WorkflowTaskInstance.java:141)
   at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:436)
   at org.alfresco.repo.workflow.jbpm.JBPMEngine$26.doInJbpm(JBPMEngine.java:1727)
   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:1695)
   … 67 more
Caused by: org.alfresco.scripts.ScriptException: 09020003 Failed to execute supplied script: 09020002 TypeError: Cannot call method "move" of undefined (AlfrescoJS#1)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeString(RhinoScriptProcessor.java:254)
   at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(ScriptServiceImpl.java:314)
   at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(ScriptServiceImpl.java:292)
   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:585)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:277)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy196.executeScriptString(Unknown Source)
   at org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript.executeScript(AlfrescoJavaScript.java:178)
   at org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript$1.doWork(AlfrescoJavaScript.java:149)
   at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:489)
   at org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript.execute(AlfrescoJavaScript.java:145)
   at org.jbpm.graph.def.Action.execute(Action.java:129)
   at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:284)
   … 118 more
Caused by: org.alfresco.error.AlfrescoRuntimeException: 09020002 TypeError: Cannot call method "move" of undefined (AlfrescoJS#1)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:473)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeString(RhinoScriptProcessor.java:250)
   … 144 more
Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot call method "move" of undefined (AlfrescoJS#1)
   at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
   at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
   at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3356)

as I said earlier when I initiate this workflow via rule, it is working fine, so I printed that variable value  and found it is undefined
I have pasted error log for same workflow on content and space as resource.
20:50:26,687 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Time to execute script: 11.758478ms
20:50:37,000 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
20:50:37,015 DEBUG [org.alfresco.repo.jscript.ScriptLogger] bpm_package.children[0] :Node Type: {http://www.alfresco.org/model/content/1.0}content, Node Aspects: [{http://www.alfresco.org/model/content/1.0}auditable, {http://www.alfresco.org/model/content/1.0}titled, {http://www.alfresco.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/content/1.0}versionable]
20:50:37,406 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Time to execute script: 405.18698ms
20:51:32,640 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
20:51:32,640 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Time to execute script: 0.674667ms
20:51:32,656 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
20:51:32,656 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Time to execute script: 3.662476ms
20:51:44,562 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
20:51:44,578 DEBUG [org.alfresco.repo.jscript.ScriptLogger]bpm_package.children[0] :undefined
20:51:56,546 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Time to execute script: 11983.046ms
20:51:56,562 ERROR [org.jbpm.graph.def.GraphElement] action threw exception: 09020003 Failed to execute supplied script: 09020002 TypeError: Cannot call method "move" of undefined (AlfrescoJS#1)
the log when I initiate the same workflow via rule is as below
08:12:15,734 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
08:12:15,750 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Time to execute script: 2.37628ms
08:12:15,921 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Time to execute script: 1600.0863ms
08:13:18,796 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
08:13:18,828 DEBUG [org.alfresco.repo.jscript.ScriptLogger]bpm_package.children[0] : Node Type: {http://www.alfresco.org/model/content/1.0}folder, Node Aspects: [{http://www.alfresco.org/model/content/1.0}auditable, {http://www.alfresco.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/application/1.0}uifacets]
08:13:19,328 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Time to execute script: 532.4545ms
the node type is showing folder instead of content. I understood that I have to send document type as folder instead of content. I tried changing in the start task at jbpmmodel.xml but didn't work.
Plz guide me to resolve this issue
Thanks

harishns
Champ in-the-making
Champ in-the-making
Hi,
I have downloaded flex air and found they are also using similar javascript which is mentioned above.
here is the code
File name : startWorkflow.post.js
    var assigner = args.assigner;
    var reviewer = args.reviewer;
    var description = args.desc;
    var workflow = actions.create("process-action");
    workflow.parameters["assigner-id"] = person.properties.userName;
    workflow.parameters["reviewer-id"] = reviewer;
    workflow.parameters["review-desc"] = description;
    workflow.execute(node);
    model.assigner = workflow.parameters["assigner-id"];   
    model.reviewer = workflow.parameters["reviewer-id"];
    model.desc = workflow.parameters["review-desc"];
I am also able to start workflow via rule like this.
so, is there any way that I can start workflow with space as reference from alfresco UI?

Thanks

harishns
Champ in-the-making
Champ in-the-making
any hopes on starting workflow on space ??   Smiley Sad