
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:
- The
Entry
column helps organizeOR
conditions OR
entries areCondType
0 andOpType
2- Entries that are considered part of the
OR
statement areOpType
4 instead of the typical 3 and are listed as entries immediately following theOR
- This implies that every entry immediately following an
OR
statement is part of that group until the firstOpType
that isn’t 4.
- This implies that every entry immediately following an
That’s all I’ve got for now.