Created
November 13, 2014 21:35
-
-
Save JamesSkemp/f4c32b090b4942bffa38 to your computer and use it in GitHub Desktop.
Sitecore Workflow State History
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use xxx_Master | |
-- Get workflow state names, ids, and counts | |
/* | |
select i2.Name, wh.NewState, count(*) | |
from WorkflowHistory wh | |
left join Items i2 on wh.NewState = i2.ID | |
group by i2.Name, wh.NewState | |
*/ | |
-- Get the last items in a particular workflow state | |
select top 100 i1.Name AS OldState, i2.Name AS NewState, IsNull(i3.Name, '--Item was deleted') AS ItemName, wh.[Date], wh.[User], wh.ItemID, wh.[Version] | |
from WorkflowHistory wh | |
left join Items i1 on wh.OldState = i1.ID | |
left join Items i2 on wh.NewState = i2.ID | |
left join Items i3 on wh.ItemID = i3.ID | |
where NewState = '{BD6CD03D-A022-401B-A8B3-B2AD3928EAAB}' | |
order by [Date] desc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment