Result of SQL Query

PDM Workflow Conditions in SQL

It took me a while to find the tables that stored the workflow conditions of a vault. It kind of makes sense once found, though. They’re treated as transition conditions but to transitions that aren’t visible to users with a source state that isn’t visible.

From what I can tell, that source state is StatusID 7. I haven’t found anything to confirm that this is always true, but across my test vault and the customer’s production vault, it has held true.

The immediate tables that are relevant for finding the information required are dbo.Transitions and dbo.TransitionConditions.

Here is a simple query that returns all workflow conditions, including some of the columns that will be useful for parsing the information:

SELECT        Transitions.Name, Transitions.TransitionID, TransitionCondition.Argument, Transitions.Source, TransitionCondition.VariableName, TransitionCondition.OpType, TransitionCondition.CondType, TransitionCondition.Entry
FROM            Transitions INNER JOIN
                         TransitionCondition ON Transitions.TransitionID = TransitionCondition.TransitionID
WHERE        (Transitions.Source = 7)

I’m sure that could be simplified without too much effort, but in the TIL format, that will do.

Other things I’ve been able to figure out are:

  1. The Entry column helps organize OR conditions
  2. OR entries are CondType 0 and OpType 2
  3. Entries that are considered part of the OR statement are OpType 4 instead of the typical 3 and are listed as entries immediately following the OR
    1. This implies that every entry immediately following an OR statement is part of that group until the first OpType that isn’t 4.

That’s all I’ve got for now.

Leave a Comment





This site uses Akismet to reduce spam. Learn how your comment data is processed.