cancel
Showing results for 
Search instead for 
Did you mean: 

how to write custom workflow in alfresco

rajupingili
Champ in-the-making
Champ in-the-making
Hi all,

am using alfresco 4.0.d, Here am writing custom workflow defination. for this am using acitivi engine. to write i am using activiti-designer-5.7.1.zip in eclipse. which was integrated successfully. by using this i have generated first.bpmn20.xml. this i kept in alfresco\WEB-INF\classes\alfresco\workflow and in bootstrap-context.xml i wrote like
               <props>
                    <prop key="engineId">activiti</prop>
                    <prop key="location">alfresco/workflow/first.bpmn20.xml</prop>
                    <prop key="mimetype">text/xml</prop>
                    <prop key="redeploy">false</prop>
                </props>
when i strat workflow in share am getting error like this.
org.alfresco.service.cmr.workflow.WorkflowException: 10160009 Workflow path activiti$8005 does not exist.

can any one help me
5 REPLIES 5

krups
Champ in-the-making
Champ in-the-making
Hi

and have you tried using workflow console http://127.0.0.1:8080/alfresco/faces/jsp/admin/workflow-console.jsp ?
also can you upload all your code here?

rajupingili
Champ in-the-making
Champ in-the-making
i have tried not working

krups
Champ in-the-making
Champ in-the-making
can you upload your code here plz?

bone
Champ on-the-rise
Champ on-the-rise
Hi,

maybe it's the same issue like <a href="https://forums.alfresco.com/forum/developer-discussions/workflow/processes-doesnt-correctly-end-work...">here</a>. It could be a bug…

I hope this helps you further…

himanshuk4u
Champ in-the-making
Champ in-the-making
i hav created simple workflow but i am getting error ->javax.el.PropertyNotFoundException: Cannot resolve identifier 'bpm_assignee'
…………..

test_demo.bpmn20.xml

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="myProcess" name="My process" isExecutable="true">
    <userTask id="visaMsc" name="visa console"  activiti:assignee="${bpm_assignee.properties.userName}"  activiti:formKey="dmy:visaconsole">
      <documentation>visa desk</documentation>
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
                      if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
                 if (typeof bpm_comment != 'undefined') task.setVariable('bpm_comment', bpm_comment);</activiti:string>
          </activiti:field>
        </activiti:taskListener>
    
         </extensionElements>
    </userTask>
    <userTask id="verify" name="verify" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="dmy:verify">
      <documentation>verify the document</documentation>
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
                      if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
if (typeof bpm_comment != 'undefined') task.setVariable('bpm_comment', bpm_comment);</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      
       <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>execution.setVariable('dmy_reviewOutcome', task.getVariable('dmy_reviewOutcome'));
      execution.setVariable('bpm_comment', task.getVariable('bpm_comment'));</activiti:string>
          </activiti:field>
        </activiti:taskListener>

      </extensionElements>
    </userTask>
    <endEvent id="end" name="End"></endEvent>
    <sequenceFlow id="flow3" sourceRef="verify" targetRef="end"></sequenceFlow>
    <startEvent id="start" name="Alfresco start"></startEvent>
    <sequenceFlow id="flow6" sourceRef="start" targetRef="visaMsc">
   </sequenceFlow>
    <sequenceFlow id="flow7" sourceRef="visaMsc" targetRef="verify"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_myProcess">
    <bpmndi:BPMNPlane bpmnElement="myProcess" id="BPMNPlane_myProcess">
      <bpmndi:BPMNShape bpmnElement="visaMsc" id="BPMNShape_visaMsc">
        <omgdc:Bounds height="55.0" width="105.0" x="180.0" y="150.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="verify" id="BPMNShape_verify">
        <omgdc:Bounds height="55.0" width="105.0" x="600.0" y="150.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
        <omgdc:Bounds height="35.0" width="35.0" x="770.0" y="160.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
        <omgdc:Bounds height="35.0" width="35.0" x="110.0" y="180.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="705.0" y="177.0"></omgdi:waypoint>
        <omgdi:waypoint x="770.0" y="177.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
        <omgdi:waypoint x="145.0" y="197.0"></omgdi:waypoint>
        <omgdi:waypoint x="180.0" y="177.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
        <omgdi:waypoint x="285.0" y="177.0"></omgdi:waypoint>
        <omgdi:waypoint x="600.0" y="177.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

######################################
test_demo-custom.xml

<?xml version="1.0" encoding="UTF-8"?>

<model name="dmy:customizeddemo" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <imports>
      <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0"
         prefix="d" />
      <!– Import Alfresco System Definitions –>
      <import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
      <!– Import User Model Definitions –>
      <import uri="http://www.alfresco.org/model/user/1.0" prefix="usr" />
      <import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm" />
   </imports>

   <namespaces>
      <namespace uri="http://www.someorganization.org/model/workflow/1.0" prefix="dmy" />
   </namespaces>

   <types>

      <type name="dmy:visaconsole">
         <parent>bpm:workflowTask</parent>

         <overrides>

            <property name="bpmSmiley TongueackageActionGroup">
               <default>add_package_item_actions</default>
            </property>
            <property name="bpmSmiley TongueackageItemActionGroup">
               <default>remove_package_item_actions</default>
            </property>
            
         </overrides>
            <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>         
         
      </type>
            
      <type name="dmy:verify">
         <parent>bpm:activitiOutcomeTask</parent>
      
         <properties>
            <property name="dmy:reviewOutcome">
               <type>d:text</type>
               <default>Reject</default>
               <constraints>
                  <constraint name="dmy:reviewOutcomeOptions" type="LIST">
                     <parameter name="allowedValues">
                        <list>
                           <value>Approve</value>
                           <value>Reject</value>
                        </list>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
         </properties>   
         
  </type>         
            
</types>


</model>
   
#####################################

and added in share-workflow-form-config.xml

<config evaluator="string-compare" condition="activiti$myProcess">
    <forms>
         <form>
            <field-visibility>
               <show id="bpm:workflowDescription" />
               <show id="bpm:workflowDueDate" />
               <show id="bpm:workflowPriority" />
               <show id="bpm:assignee" />
               <show id="packageItems" />
               <show id="bpm:sendEMailNotifications" />
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.general" />
               <set id="info" appearance="" template="/org/alfresco/components/form/2-column-set.ftl" />
               <set id="assignee" appearance="title" label-id="workflow.set.assignee" />
               <set id="items" appearance="title" label-id="workflow.set.items" />
               <set id="other" appearance="title" label-id="workflow.set.other" />
              
               <field id="bpm:workflowDescription" label-id="workflow.field.message">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl">
                     <control-param name="style">width: 95%</control-param>
                  </control>
               </field>
               <field id="bpm:workflowDueDate" label-id="workflow.field.due" set="info" />
               <field id="bpm:workflowPriority" label-id="workflow.field.priority" set="info">
                  <control template="/org/alfresco/components/form/controls/workflow/priority.ftl" />
               </field>
               <field id="bpm:assignee" label-id="workflow.field.assign_to" set="assignee" />
               <field id="packageItems" set="items" />
               <field id="bpm:sendEMailNotifications" set="other">
                  <control template="/org/alfresco/components/form/controls/workflow/email-notification.ftl" />
               </field>
            </appearance>
         </form>
      </forms>
   </config>
  
  
   <config evaluator="task-type" condition="dmy:visaconsole">
      <forms>
         <form>
            <field-visibility>
               <show id="message" />
               <show id="bpm:dueDate" />
               <show id="bpmSmiley Tongueriority" />
               <show id="bpm:assignee" />
               <show id="packageItems" />
               <show id="bpm:comment" />
               <show id="transitions" />
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.general" />
               <set id="info" appearance=""
                  template="/org/alfresco/components/form/2-column-set.ftl" />
               <set id="items" appearance="title" label-id="workflow.set.items" />
               <set id="assignee" appearance="title" label-id="workflow.set.assignee" />
               <set id="other" appearance="title" label-id="workflow.set.other" />
               <set id="response" appearance="title" label-id="workflow.set.response" />


               <field id="message" label-id="workflow.field.message">
                  <control template="/org/alfresco/components/form/controls/info.ftl" />
               </field>

               <field id="bpmSmiley Tongueriority" label-id="workflow.field.priority"
                  set="info" read-only="true">
                  <control
                     template="/org/alfresco/components/form/controls/workflow/priority.ftl" />
               </field>
               <field id="bpm:assignee" label-id="workflow.field.assign_to" set="assignee" />
               <field id="bpm:dueDate" set="info" label-id="workflow.field.due">
                  <control template="/org/alfresco/components/form/controls/info.ftl" />
               </field>

               <field id="packageItems" set="items" />

            

               <field id="bpm:comment" label-id="workflow.field.comment"
                  set="response">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl" />
               </field>

               <field id="transitions" set="response" />

            </appearance>
         </form>
      </forms>
   </config>
  
   <config evaluator="task-type" condition="dmy:verify">
      <forms>
         <form>
            <field-visibility>
               <show id="message" />
               <show id="taskOwner" />
               <show id="bpmSmiley Tongueriority" />
               <show id="bpm:dueDate" />
               <show id="bpm:taskId" />
               <show id="bpm:status" />
               <show id="packageItems" />
               <show id="bpm:comment" />
               <show id="transitions" />
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.task.info" />
               <set id="info" appearance="" template="/org/alfresco/components/form/3-column-set.ftl" />
               <set id="progress" appearance="title" label-id="workflow.set.task.progress" />
               <set id="items" appearance="title" label-id="workflow.set.items" />
               <set id="response" appearance="title" label-id="workflow.set.response" />
              
               <field id="message">
                  <control template="/org/alfresco/components/form/controls/info.ftl" />
               </field>
               <field id="taskOwner" set="info" />
               <field id="bpm:taskId" set="info">
                  <control template="/org/alfresco/components/form/controls/info.ftl" />
               </field>
               <field id="bpmSmiley Tongueriority" set="info" read-only="true">
                  <control template="/org/alfresco/components/form/controls/workflow/priority.ftl" />
               </field>
               <field id="bpm:dueDate" set="info" label-id="workflow.field.due">
                  <control template="/org/alfresco/components/form/controls/info.ftl" />
               </field>
               <field id="bpm:status" set="progress" />
               <field id="packageItems" set="items" />
               <field id="bpm:comment" label-id="workflow.field.comment" set="response">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl" />
               </field>
               <field id="transitions" set="response" />
            </appearance>
         </form>
      </forms>
   </config>
#############################

and created bean in bootsrap-context.xml

<bean id="myProcess.workflowBootstrap" parent="workflowDeployer">
        <property name="workflowDefinitions">
            <list>
     
                <props>
                    <prop key="engineId">activiti</prop>
                    <prop key="location">alfresco/workflow/test_demo.bpmn20.xml</prop>
                    <prop key="mimetype">text/xml</prop>
                    <prop key="redeploy">false</prop>
                </props>

            </list>
        </property>
        <property name="models">
            <list>
               <value>alfresco/workflow/test_demo-custom.xml</value>
            </list>
        </property>
      
      </bean>
pls help me out…….i hav been stucked it vry long

org.activiti.engine.ActivitiException: Unknown property used in expression
   at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:55)
   at org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior.handleAssignments(UserTaskActivityBehavior.java:98)
   at org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior.execute(UserTaskActivityBehavior.java:85)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:44)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:80)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:546)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:541)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:52)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:80)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:546)


Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'bpm_assignee'
   at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)
   at org.activiti.engine.impl.juel.AstProperty.eval(AstProperty.java:52)
   at org.activiti.engine.impl.juel.AstProperty.eval(AstProperty.java:52)
   at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50)
   at org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:26)
   at org.activiti.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)
   at org.activiti.engine.impl.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33)
   at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
   at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
   at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:50)