cancel
Showing results for 
Search instead for 
Did you mean: 

upload and workflow submit

robain
Champ in-the-making
Champ in-the-making
Hi
I want to be able to upload a document and automatically submit it for workflow within the same webscript. Is that possible? I get the following error when I try it. Anyone has any idea if this is possible.

thanks.

48:40,106 ERROR [graph.def.GraphElement] action threw exception: Failed to execute supplied script: Failed to execute supplied script: Wrapped java.lang.Null
nterException (AlfrescoScript#1)
.alfresco.service.cmr.repository.ScriptException: Failed to execute supplied script: Failed to execute supplied script: Wrapped java.lang.NullPointerExceptio
AlfrescoScript#1)
     at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(ScriptServiceImpl.java:283)
     at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(ScriptServiceImpl.java:257)
     at sun.reflect.GeneratedMethodAccessor773.invoke(Unknown Source)
     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:281)
     at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
     at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
     at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
     at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:245)
     at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
     at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
     at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
     at $Proxy47.executeScriptString(Unknown Source)
     at org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript.executeScript(AlfrescoJavaScript.java:159)
     at org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript.execute(AlfrescoJavaScript.java:133)
     at org.jbpm.graph.def.Action.execute(Action.java:122)
2 REPLIES 2

robain
Champ in-the-making
Champ in-the-making
i am trying to do this with webscripts but without much success. however keeping creation of content  and workflow webscripts seperate works just fine. I just want to have a way to start workflow automatically on some content upload. any help is much appreciated.


     //…uploaded file is created. then i try to start the workflow.
     upload.save();
     
      var resultString = "";
     
     
      var workflowNodeId = upload.id;
      if ((workflowNodeId != "") && (workflowNodeId != null) )
      {
         var workflowNode = search.findNode("workspace://SpacesStore/" + workflowNodeId);
      
         if (workflowNode != null)
         {
            try
            {
            var wflow = actions.create("start-workflow");
            wflow.parameters.workflowName
                   = "jbpm$matriawf:customReviewWorkflow";
            wflow.execute(workflowNode);
            resultString = "Workflow Started!";
            }
            catch (e)
            {
               resultString = "Failed to start workflow"+e;
            }
         }
      }

i get this error while trying to get the version history at the start of the workflow. any ideas.
net.sf.acegisecurity.BadCredentialsException: Bad credentials presented

thanks.

robain
Champ in-the-making
Champ in-the-making
HELP - anyone has any idea why i am getting this when i try to start a workflow on a node i just created.

Thanks


net.sf.acegisecurity.BadCredentialsException - Bad credentials presented 
   
net.sf.acegisecurity.providers.dao.DaoAuthenticationProvider.authenticate(DaoAuthenticationProvider.java:290) 
net.sf.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:159) 
net.sf.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:49) 
net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:372) 
net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:77) 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) 
org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49) 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) 
org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:245) 
org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69) 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) 
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107) 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210) 
$Proxy3.exists(Unknown Source) 
org.alfresco.repo.version.VersionServiceImpl.getVersionHistory(VersionServiceImpl.java:422) 
com.someco.repo.action.executer.SomeAction.executeImpl(Unknown Source) 
org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:120) 
org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:537) 
org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:472) 
org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:399) 
org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:387) 
org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:545) 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)