transition comment in API

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?

SolidworksSolidworks Pdm enterprise Pdm
Answers 5
SF
SF 2010-05-26 Best Answer

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

SF
SF 2010-05-26

I am able to get the version comment, but in this scenario, the transition comment is the reason for sending the document back to the previous step, not what changed between versions.

SF
SF 2010-05-26

Could you query the database directly?

JS
JS 2010-05-27

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

SF
SF 2010-05-27

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.