cancel
Showing results for 
Search instead for 
Did you mean: 

Can't delete the data from workflow

zg0571
Champ in-the-making
Champ in-the-making
Hi.
I made some custom workflow and run well.But I can't delete all my data from the workflow.
I try to delete them in the Workflow Console, use the commond "delete workflow" and "undeploy definition".But the final result is always despaired.
Any one who can help me? Smiley Sad
6 REPLIES 6

davidc
Star Contributor
Star Contributor
I try to delete them in the Workflow Console, use the commond "delete workflow" and "undeploy definition".But the final result is always despaired.

Are you getting an error?  Some more info will be useful to diagnose.

zg0571
Champ in-the-making
Champ in-the-making
I use the command "delete workflow <workflowId>",it says:

org.springframework.dao.DataIntegrityViolationException: could not delete: [org.jbpm.graph.exe.Token#453]; nested exception is org.hibernate.exception.ConstraintViolationException: could not delete: [org.jbpm.graph.exe.Token#453]

I also use "undeploy definition <workflowId>",it says:

org.alfresco.service.cmr.workflow.WorkflowException: Failed to deploy workflow definition

Davidc, if there is a nother way  to delete them? I'm very urgently. Smiley Tongue

schambon
Champ in-the-making
Champ in-the-making
Isn't this AR-885 (Cancel Workflow causes constraint error on database)?

davidc
Star Contributor
Star Contributor
Which version of Alfresco are you using?

There's no easy way of deleting your workflow instance - jBPM is having trouble deleting the database rows without violating its constraints.

We've hit several of those before, but have resolved them.  This may be a new issue.

Can you post all your workflow definition related files?  If so, I could possibly try to reproduce.

zg0571
Champ in-the-making
Champ in-the-making
Thanks to reply. That's my workflow definition .I also find the button "reassign" and pagination are unavailability. I think my definition cause the error,but I can't find the causation.



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

<process-definition
  xmlns="urn:jbpm.org:jpdl-3.2"  name="hxoa:corpsendoa">
   <swimlane name="initiator"/>
   <start-state name="stardraft">
           <event type="node-leave">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
               <variable name="bpm_workflowDescription" access="write"/>
               <expression>
                  bpm_package.children[0].addAspect("my:hxoacontent");
                     bpm_package.children[0].save();
                    
                  if (logger.isLoggingEnabled())
                  logger.log("========== Entering action to set Move Doc to Pending Approval folder in Start State");
   
                var extnamelocal = bpm_package.children[0].name.lastIndexOf(".");
                if (extnamelocal > 0)
                     bpm_workflowDescription = bpm_package.children[0].name.substring(0, extnamelocal);
                 else
                     bpm_workflowDescription = bpm_package.children[0].name;
                    
                  if (logger.isLoggingEnabled())
                  logger.log("========== Exiting action to set Move Doc to Pending Approval folder in Start State");      
               </expression>
            </script>
         </action>
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
              <script>
                 <variable name="hxoa_Typename" access="write"/>
                 <expression>hxoa_Typename = "companysendoa";</expression>
              </script>
            </action>
        </event>
      <task name="hxoa:senddraft" swimlane="initiator">
     </task>
      <transition name="complete" to="officercheck"></transition>
   </start-state>
   <task-node name="officercheck">
       <event type="node-enter">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
           <script>
                <variable name="hxoa_draft_OfficeReviwer" access="read,write"/>
                <variable name="hxoa_officemaster" access="read"/>
                <expression>
                       hxoa_draft_OfficeReviwer = hxoa_officemaster.properties["cm:firstName"]+hxoa_officemaster.properties["cm:lastName"];                   
                </expression>
            </script>
      </action>
      </event>
      <task name="hxoa:officeaudit">
         <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <actor>#{hxoa_officemaster}</actor>
         </assignment>
     </task>
      <transition name="agree" to="leadercheck">
     </transition>
      <transition name="disagree" to="restart">
      </transition>
       <event type="node-leave">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                  <variable name="hxoa_officeauditcontentout" access="read,write"/>
                  <variable name="hxoa_officeauditcontent" access="read"/>
                  <expression>
                     if(hxoa_officeauditcontent == null)
                           hxoa_officeauditcontent = "";
                       now=new Date();
                 timestr=now.toLocaleString();
                     hxoa_officeauditcontentout = hxoa_officeauditcontent + "(" + person.properties.firstName + person.properties.lastName + "," + timestr + ")";
                    
                  </expression>
               </script>
           </action>
      </event>
   </task-node>
   <task-node name="leadercheck">
      <event type="node-enter">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                  <variable name="hxoa_draft_Reviewer" access="read,write"/>
                  <variable name="hxoa_corpleader" access="read"/>
                  <expression>
                       hxoa_draft_Reviewer = hxoa_corpleader.properties["cm:firstName"]+hxoa_corpleader.properties["cm:lastName"];
                  </expression>
                    </script>
       </action>
      </event>   
      <task name="hxoa:leaderaudit" >
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{hxoa_corpleader}</actor>
      </assignment>
      </task>
      <transition name="agree" to="approve">
      </transition>
      <transition name="disagree" to="restart"></transition>
      <event type="node-leave">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                  <variable name="hxoa_leaderpreauditcontentout2" access="read,write"/>
                  <variable name="hxoa_leaderpreauditcontent" access="read"/>
                  <expression>
                       if(hxoa_leaderpreauditcontent == null)
                           hxoa_leaderpreauditcontent = "";
                       now=new Date();
                 timestr=now.toLocaleString();
                     hxoa_leaderpreauditcontentout2 = hxoa_leaderpreauditcontent + "(" + person.properties.firstName + person.properties.lastName + "," + timestr + ")";
                  </expression>
               </script>
       </action>
     </event>
   </task-node>  
   <node name="approve">
      <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
         <foreach>#{hxoa_corpjointsignature}</foreach>
         <var>reviewer</var>
      </action>
      <event type="node-enter">
          <script>
              <variable name="hxoa_approveCount" access="write" />
              <expression>
                  hxoa_approveCount = 0;
             </expression>
          </script>       
      </event>
      <transition name="" to="meetreview" />
   </node>
   <task-node name="meetreview">
      <task name="hxoa:draftapprove">
         <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <actor>#{reviewer}</actor>
         </assignment>
      </task>
      <transition name="agree" to="endreview">
         <script>
             <variable name="hxoa_approveCount" access="read,write" />
             <expression>
                 hxoa_approveCount = hxoa_approveCount +1;
              </expression>
         </script>
      </transition>
      <transition name="disagree" to="endreview" />
   </task-node>
   <join name="endreview">
            <event type="node-enter">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                  <variable name="hxoa_jointsignaturecontent" access="read,write"/>
                  <variable name="hxoa_draftapprovecontent" access="read"/>
                  <expression>
                       if(hxoa_jointsignaturecontent == null)
                           hxoa_jointsignaturecontent = "";
                       now=new Date();
                 timestr=now.toLocaleString();
                     hxoa_jointsignaturecontent = hxoa_draftapprovecontent + "(" +person.properties.firstName + person.properties.lastName + ","  + timestr + ");";
                  </expression>
               </script>
            </action>
         </event>
      <transition to="appresult" />
   </join>
   <decision name="appresult">
      <event type="node-enter">
         <script>
            <variable name="hxoa_reviewerCount" access="write"/>
            <expression>
                hxoa_reviewerCount = hxoa_corpjointsignature.size();
            </expression>
         </script>
      </event>
      <transition name="disagree" to="restart">
      </transition>
      <transition name="agree" to="leadersignout">
      <condition>#{hxoa_approveCount == hxoa_reviewerCount}</condition>
      </transition>
         <event type="node-leave">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
               <variable name="hxoa_jointallcontent" access="read,write"/>
               <variable name="hxoa_jointsignaturecontent" access="read"/>
               <expression>
                  hxoa_jointallcontent = hxoa_jointallcontent + hxoa_jointsignaturecontent;
               </expression>
               </script>
            </action>
         </event>
   </decision>

   <task-node name="restart">
      <task name="hxoa:redraft" swimlane="initiator" >
    </task>
      <transition name="complete" to="officercheck"></transition>
      <transition name="delete" to="automove"></transition>
   </task-node>
   <task-node name="leadersignout">
      <event type="node-enter">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                  <variable name="hxoa_draft_Writeout" access="read,write"/>
                  <variable name="hxoa_corpleader" access="read"/>
                  <expression>
                       hxoa_draft_Writeout = hxoa_corpleader.properties["cm:firstName"]+hxoa_corpleader.properties["cm:lastName"];                   
                  </expression>
                    </script>
       </action>
      </event>
      <task name="hxoa:officeleadersign" >
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{hxoa_corpleader}</actor>
      </assignment>
      </task>
      <transition name="agree" to="officeclearup">
      </transition>
      <transition name="disagree" to="restart"></transition>
      <event type="node-leave">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                  <variable name="hxoa_leadersignoutcontentout" access="write"/>
                  <variable name="hxoa_leadersignoutcontent" access="read"/>
                  <expression>
                       if(hxoa_leadersignoutcontent == null)
                       hxoa_leadersignoutcontent = "";
                       now=new Date();
                 timestr=now.toLocaleString();
                     hxoa_leadersignoutcontentout = hxoa_leadersignoutcontent + "(" + person.properties.firstName + person.properties.lastName + "," + timestr + ")";
                  </expression>
               </script>
        </action>
     </event>
   </task-node>
   <task-node name="officeclearup">
   <event type="node-enter">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                  <variable name="hxoa_button_view" access="read,write"/>
                  <expression>
               if(hxoa_button_view !="false")
                       hxoa_button_view ="true"             
                  </expression>
                    </script>
       </action>
      </event>
      <task name="hxoa:officeclearup" >
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{hxoa_officelcearupperson}</actor>
      </assignment>
      </task>
      <transition name="" to="passaround"></transition>
         <event type="node-leave">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                  <variable name="hxoa_button_view" access="write"/>
                  <expression>
                   if(hxoa_button_view=="true")
                        hxoa_button_view ="false" 
                  </expression>
               </script>
        </action>
     </event>
</task-node>
   <task-node name="passaround">
      <task name="hxoa:officepass" >
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{hxoa_officepassperson}</actor>
      </assignment>
      </task>
      <transition name="" to="transact"></transition>
</task-node>
   <process-state name="transact">
      <sub-process name="hxoa:handleandpass" />
      <variable name="hxoa_corpaccepthandlers" access="read,write"/>
      <variable name="hxoa_corpacceptpassers" access="read,write"/>
      <variable name="bpm_package" access="read,write"/>
      <variable name="hxoa_draft_Title" access="read,write"/>
      <variable name="hxoa_draft_Writeout" access="read,write"/>
      <variable name="hxoa_draft_Reviewer" access="read,write"/>
      <variable name="hxoa_draft_OfficeReviwer" access="read,write"/>
      <variable name="hxoa_draft_MeetReviewer" access="read,write"/>
      <variable name="hxoa_draft_Check" access="read,write"/>
      <variable name="hxoa_draft_Topic" access="read,write"/>
      <variable name="hxoa_draft_Author" access="read,write"/>
      <variable name="hxoa_draft_department" access="read,write"/>
      <variable name="hxoa_draft_Mainsend" access="read,write"/>
      <variable name="hxoa_draft_Copysend" access="read,write"/>
      <variable name="hxoa_draft_SendNo" access="read,write"/>
      <variable name="hxoa_draft_Sendcount" access="read,write"/>
      <variable name="hxoa_draft_From" access="read,write"/>
      <variable name="hxoa_draft_Senddate" access="read,write"/>
      <variable name="hxoa_draft_Instancy" access="read,write"/>
      <variable name="hxoa_draft_Secret" access="read,write"/>
      <variable name="hxoa_officeauditcontentout" access="read,write"/>
      <variable name="hxoa_leaderpreauditcontentout2" access="read,write"/>
      <variable name="hxoa_jointallcontent" access="read,write"/>
      <variable name="hxoa_leadersignoutcontentout" access="read,write"/>
      <transition name="" to="automove"></transition>
   </process-state>
   <node name="automove">
     <event type="node-enter">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
         <script>
            <expression>
               if (logger.isLoggingEnabled())
               logger.log("========== Entering action to set Move Doc to Pending Approval folder in Start State");

               var dest = companyhome.childByNamePath("companyhome");
               bpm_package.children[0].move(dest);
              
               if (logger.isLoggingEnabled())
               logger.log("========== Exiting action to set Move Doc to Pending Approval folder in Start State");
            </expression>
         </script>
      </action>
     </event>
      <transition name="" to="end"></transition>
   </node>
   <end-state name="end"></end-state>
</process-definition>


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

<process-definition
  xmlns="urn:jbpm.org:jpdl-3.2"  name="hxoa:handleandpass">
   <swimlane name="initiator"/>
   <start-state name="start">
   <transition name="" to="fork1"></transition>
   </start-state>
   <fork name="fork1">
      <transition name="tr2" to="bypass"></transition>
      <transition name="tr3" to="bytransact"></transition>
   </fork>
   <process-state name="bytransact">
      <sub-process name="hxoa:mulpersonhandle" />
      <variable name="hxoa_corpaccepthandlers" access="read,write"/>
      <variable name="bpm_package" access="read,write"/>
      <variable name="hxoa_draft_Title" access="read,write"/>
      <variable name="hxoa_draft_Writeout" access="read,write"/>
      <variable name="hxoa_draft_Reviewer" access="read,write"/>
      <variable name="hxoa_draft_OfficeReviwer" access="read,write"/>
      <variable name="hxoa_draft_MeetReviewer" access="read,write"/>
      <variable name="hxoa_draft_Check" access="read,write"/>
      <variable name="hxoa_draft_Topic" access="read,write"/>
      <variable name="hxoa_draft_Author" access="read,write"/>
      <variable name="hxoa_draft_department" access="read,write"/>
      <variable name="hxoa_draft_Mainsend" access="read,write"/>
      <variable name="hxoa_draft_Copysend" access="read,write"/>
      <variable name="hxoa_draft_SendNo" access="read,write"/>
      <variable name="hxoa_draft_Sendcount" access="read,write"/>
      <variable name="hxoa_draft_From" access="read,write"/>
      <variable name="hxoa_draft_Senddate" access="read,write"/>
      <variable name="hxoa_draft_Instancy" access="read,write"/>
      <variable name="hxoa_draft_Secret" access="read,write"/>
      <variable name="hxoa_officeauditcontentout" access="read,write"/>
      <variable name="hxoa_leaderpreauditcontentout" access="read,write"/>
      <variable name="hxoa_jointallcontent" access="read,write"/>
      <variable name="hxoa_leadersignoutcontentout" access="read,write"/>
      <transition name="" to="join1"></transition>
   </process-state>
   <process-state name="bypass">
      <sub-process name="hxoa:mulpersonpass" />
      <variable name="hxoa_corpacceptpassers" access="read,write"/>
      <variable name="bpm_package" access="read,write"/>
      <variable name="hxoa_draft_Title" access="read,write"/>
      <variable name="hxoa_draft_Writeout" access="read,write"/>
      <variable name="hxoa_draft_Reviewer" access="read,write"/>
      <variable name="hxoa_draft_OfficeReviwer" access="read,write"/>
      <variable name="hxoa_draft_MeetReviewer" access="read,write"/>
      <variable name="hxoa_draft_Check" access="read,write"/>
      <variable name="hxoa_draft_Topic" access="read,write"/>
      <variable name="hxoa_draft_Author" access="read,write"/>
      <variable name="hxoa_draft_department" access="read,write"/>
      <variable name="hxoa_draft_Mainsend" access="read,write"/>
      <variable name="hxoa_draft_Copysend" access="read,write"/>
      <variable name="hxoa_draft_SendNo" access="read,write"/>
      <variable name="hxoa_draft_Sendcount" access="read,write"/>
      <variable name="hxoa_draft_From" access="read,write"/>
      <variable name="hxoa_draft_Senddate" access="read,write"/>
      <variable name="hxoa_draft_Instancy" access="read,write"/>
      <variable name="hxoa_draft_Secret" access="read,write"/>
      <variable name="hxoa_officeauditcontentout" access="read,write"/>
      <variable name="hxoa_leaderpreauditcontentout" access="read,write"/>
      <variable name="hxoa_jointallcontent" access="read,write"/>
      <variable name="hxoa_leadersignoutcontentout" access="read,write"/>
      <transition name="" to="join1"></transition>
   </process-state>
   <join name="join1">
      <transition name="" to="end1"></transition>
   </join>
   <end-state name="end1"></end-state>
</process-definition>

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

<process-definition
  xmlns="urn:jbpm.org:jpdl-3.2"  name="hxoa:mulpersonhandle">
   <transition name="" to="node1"></transition>
   </start-state>
   <node name="node1">
      <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
         <foreach>#{hxoa_corpaccepthandlers}</foreach>
         <var>handler</var>
      </action>  
      <transition name="" to="task1"></transition>
   </node>
   <task-node name="task1">
      <task name="hxoa:corpaccepthandle" >
         <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <actor>#{handler}</actor>
         </assignment>
      </task>
      <transition name="" to="join1"></transition>
   </task-node>
   <join name="join1">
      <transition name="" to="end1"></transition>
   </join>
   <end-state name="end1"></end-state>
   <event type="process-end">
   <script>
   System.out.println("—————-handle end—————");
   </script>
   </event>
</process-definition>

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

<process-definition
  xmlns="urn:jbpm.org:jpdl-3.2"  name="hxoa:mulpersonpass">
   <start-state name="start">
   <transition name="" to="node1"></transition>
   </start-state>
   <node name="node1">
      <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
         <foreach>#{hxoa_corpacceptpassers}</foreach>
         <var>passer</var>
      </action>
      <transition name="" to="task1"></transition>
   </node>
   <task-node name="task1">
      <task name="hxoa:corpacceptpass" >
         <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <actor>#{passer}</actor>
         </assignment>
      </task>
      <transition name="" to="join1"></transition>
   </task-node>
   <join name="join1">
      <transition name="" to="end1"></transition>
   </join>
   <end-state name="end1"></end-state>
   <event type="process-end">
   <script>
   System.out.println("—————-pass end—————");
   </script>
   </event>
</process-definition>

davidc
Star Contributor
Star Contributor
That's some process definition.

Can you tell me if all your workflow instances of your definition fail to delete?

I also find the button "reassign" and pagination are unavailability

What do you mean by this?