5 Replies Latest reply on May 27, 2010 1:04 PM by Jeremy Schmidt

    transition comment in API

    Jeremy Schmidt

      Is there a way to capture the transition comment within the API or better yet, without the API?  Here is my scenario.

       

      User A sends a document from workflow state 1 to state 2

      the user login is stored in the SubmitterEmail variable on the card

      User B decides a change needs to be made and send the document back to state 1

      my addin runs prestate change and sends an email to User A using the SubmitterEmail variable

      SubmitterEmail is then cleared by the transition

       

      I'd like the User B's comments from the transition of state 2 to 1 to be included in the email, but I'm not finding a way to capture this data.

       

      Any suggestions?

        • Re: transition comment in API
          Jeff Walters

          Is your transition comment the same as version comment? If so you might want to look at IEdmVersion5.

          • Re: transition comment in API
            Jeff Sweeney

            You can get the transition comment through the EdmHistory object.

             

            This snippet shows all transition comments for objFile:

             

            Dim objHistory as IEdmHistory

            objHistory = objVault.CreateUtility(EdmUtility.EdmUtil_History)
            objHistory.AddFile(objFile.ID)
            Dim ppoHistory() As EdmHistoryItem 'this array will hold all transition information
            objHistory.GetHistory(ppoHistory, EdmHistoryType.Edmhist_FileState)
            For intCounter = 0 To UBound(ppoHistory)
              ppoHistory(intCounter).mbsComment 'Comment
            Next Counter

              • Re: transition comment in API
                Jeremy Schmidt

                This was almost exactly what I needed.  Thanks so much for the help.

                 

                I ended up having to change the hook to poststate, because the last transition comment wasn't available in prestate (which makes sense).  I originally had it as prestate since I was removing the SubmitterEmail variable during the same "rejection" transition.  I have since switched my code to use the same history object to find the user executing the "submit" transitions and removed the SubmitterEmail variable from the datacard.  This works fine, but I am of the belief that it's better to configure than to create custom code.  I'd much rather use the standard options (the variables in this case), than code that is looking for specific state names.  Do you have any suggestions other than creating another secondary state and automatic transition that would reset the SubmitterEmail variable so I could still get the variable poststate?  I hope that makes sense.