Hi guys! I would like to ask if you guys know where I can find the record transaction of activities in workflow in K2 database? I want to do audit trail for overview of activities in the workflow.
Where can I find transaction history for activities in workflow
Best answer by Arvindsct
Hello
you can run below query to get it.
SELECT
pi.Folio,
ai.ID AS ActivityInstID,
ad.[User] AS DestinationUser,
CASE ai.Status
WHEN 0 THEN 'Active'
WHEN 1 THEN 'Complete'
WHEN 2 THEN 'Sleep'
WHEN 4 THEN 'Declined'
ELSE CAST(ai.Status AS VARCHAR)
END AS Status,
ai.StartDate AS Started,
ai.FinishDate AS Finished,
CASE
WHEN ai.FinishDate IS NULL OR ai.Status = 0 THEN
CAST(DATEDIFF(HOUR, ai.StartDate, GETDATE()) / 24 AS VARCHAR) + 'd ' +
CAST(DATEDIFF(HOUR, ai.StartDate, GETDATE()) % 24 AS VARCHAR) + 'h'
ELSE
CAST(DATEDIFF(HOUR, ai.StartDate, ai.FinishDate) / 24 AS VARCHAR) + 'd ' +
CAST(DATEDIFF(HOUR, ai.StartDate, ai.FinishDate) % 24 AS VARCHAR) + 'h'
END AS Duration
FROM [ServerLog].[ActInst] ai
INNER JOIN [ServerLog].[ActInstDest] ad ON ad.ActInstID = ai.ID
AND ad.ProcInstID = ai.ProcInstID
INNER JOIN [ServerLog].[ProcInst] pi ON pi.ID = ai.ProcInstID
ORDER BY ai.StartDate DESC;
Feel free to reach out to us if you need any supports Automate@proinception.com
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.



