2 Replies Latest reply on Oct 10, 2012 4:22 PM by Jim Sculley

    Making sense of the file history dialog

    Jim Sculley

      I have a file going through a workflow that looks like this:




      For the purpose of this discussion, the file will travel through the Release Drawing and No Approval Required branches of this workflow.  Both No Approval Required and QA Approval Required ultimately end in the final state Approved.


      There are two transition actions in the Release Drawing transition that both set variables that are mapped to custom properties in the drawing.

      There are 27 transition actions in the No Approval Required transition that all set variables that are mapped to custom properties in the drawing.

      There is an Increment Revision action in the No Approval Required transition.


      A file sent through this workflow will consistently have the following history:



      For the most part, the history is straightforward, reading from bottom to top:


      1.  The file is created/added to the vault.  In this instance, I cut and pasted an existing file (499001).

      2.  The file was renamed (from 499001 to 499002) by me.

      3.  The file was checked in by me.

      4.  The system assigns it to a workflow and transitions it to the initial state (CAD Work In Progress).

      5.  The file is transitioned from CAD Work In Progress to Release Pending by me, via the Submit For Release transition.

      6.  The file moves from Release Pending to Approval Pending via the automatic transition Release Drawing.  The transition conditions simply check that a variable has a value.

      7.  The file is checked in.

      8.  The file is checked in again.

      8.  The file moves from Approval Pending to Approved via the automatic transition No Approval Required.  The transition conditions once again check the value of a couple of variables.

      9.  The file revision is incremented.


      Steps 7 and 8 are the ones that bother me.  Clearly, the system has checked the file out to perform some modification and then checked it in.  The question is what prompts this check out operation?  At first I thought that it was the transition actions that set the variables.  But if this were the case I would expect to see either:

                a.  One check in after step 6 and then the second check in after what is step 8 above (one check out/in per set of transition actions for a single state change).  After all, both the Release Drawing and No Approval Required transitions have actions that set variables mapped to properties.

                b.  Twenty seven check in operations after what is step 8 above (one check out/in for each transition action during a single state change.  If there are two check ins after the Release Drawing transition (which has 2 Set Variable actions), there should be 27 check ins after the No Approval Required transition (which has 27 Set Variable actions).


      The history dialog as shown simply doesn't make sense to me. 


      Either the history lines are out of order, or the system doesn't behave in a consistent predictable way when performnig the same type of operation in different transitions.


      It would be very helpful if SolidWorks provided a sequence diagram showing what happens when and provided a little more context (such as a comment) when checking files in and out automatically.


      The history becomes even more difficult to decipher if you have custom add-ins that check files in and out and/or initiate transitions.


      Jim S.

        • Re: Making sense of the file history dialog
          Jeremy Feist

          your steps in red are from the transition actions. it is just doing the first one AFTER the transition and the second one BEFORE the transition. it does it this way because that is when you have check-out rights (I assume).


          if you try this again and what a minute or 2 between those transitions, you will be able to see this in the time stamps.

            • Re: Making sense of the file history dialog
              Jim Sculley

              That would make sense if I wasn't logged in as a user with full permissions in all states.  Unless the system decides to perform the transition actions before/after based on the most restrictive state permissions amongst the users with permission to move files between the two states.


              I changed all the relevant transitions from automatic to manual and waited a couple of minutes between state changes.  The lines in the history dialog are identical to those in my original post.


              Just for grins, I removed the Increment Revision action from the No Approval Required transition and now the history looks like this:



              This is what I would expect to see.  Apparently, if an Increment Revision action exists, the system performs the transition actions before the state change, otherwise they are performed after.


              Now I have to wrap my head around how this discovery may impact my custom add-ins which rely heavily on PreState and PostState event hooks.  If variables are going to be set before the state is changed sometimes and after the state is changed at other times, querying those variables in a PreState or PostState event hook is a dangerous proposition.


              Jim S.