Identifying workflow transitions

Several transition rules can be attached to a workflow state. You can identify the available workflow steps using the ID of the record that you're progressing through the workflow.

For example, on an opportunity record whose ID is 11, use the following SQL to return the oppo_workflowid (1167):

Copy
SELECT oppo_workflowid FROM opportunity WHERE oppo_opportunityid =11

Then use the following to retrieve the workflowinstance record:

Copy
SELECT wkin_workflowid, wkin_currentstateid FROM workflowinstance WHERE wkin_instanceid = 1167

This returns the workflowid details and current state:

Copy
wkin_workflowid =2
wkin_currentstateid =10

Which you can use to find the next possible transitions:

Copy
SELECT wktr_nextstateid FROM workflowtransition WHERE wktr_workflowid = 2 and wktr_stateid = 10