Skip to main content

I am attempting to create an email that gives a daily summary to users who have active lists in K2. This would collect all of the worklist items in their list and email them to them every morning but it would only email those who have active tasks. I have attempting to create a reference to the task smartobject in the system folder but when I attempt to loop through it I end up getting everything in one giant group. Anyone have some ideas on how to accomplish this. I am trying to avoid people getting 40 email notifications when they have 40 tasks.

 

Thanks, 

Ben

Hi Ben,

I think you can do it on web service call to K2 api. below is service and api available
https://help.k2.com/onlinehelp/k2five/devref/5.2/default.htm#Runtime/WorkflowAPIs.htm

Example if you use API to Retrieving worklist item as 'Active' status as link blow. you can make a batch job running every morning a day, Retrieving worklist and sent email for each user. So you can sent email via coding.
https://help.k2.com/onlinehelp/k2five/devref/5.2/default.htm#Runtime/WF-Client/Retrieve-worklist.html%3FTocPath%3DRuntime%2520APIs%2520and%2520Services%7CWorkflow%7CWorkflow%2520Client%2520API%7CWorkflow%2520Client%2520API%2520Samples%7C_____3

Thank you for the direction on this. I'm not really at the point of being able to write web services to accomplish this and was hoping there was a way to write a workflow to query the smartobject and then write it all out to a table. I can do this in MS Flow with my own tasks but wanted to make it possible to set this up for everyone.


Did you ever find a method for this??? I have the same requirement and want to go down a good starting point for investigation.


Hi, you can try create Stored Procedure, 

for example:

WITH cte AS (

SELECT ps.[DisplayName] AS [ProcessName],pi.Folio,a.DisplayName AS [ActivityName],pi.Originator, aid.[User] AS [AssignedTo], wlh.[Data] AS [Task URL] --,wlh.InstructionField, pi.DelegatedBy --,aid.*  --

FROM [K2DB].[Server].[WorklistHeader] wlh

JOIN [K2DB].[Server].[WorklistSlot] wls ON wls.ActInstID = wlh.ActInstID AND wls.EventInstID = wlh.EventInstID AND wls.ProcInstID = wlh.ProcInstID and wls.Status != 4

JOIN [K2].[Server].[ProcInst] pi WITH (NOLOCK) ON pi.ID = wlh.ProcInstID

JOIN [K2].[Server].[Proc] p WITH (NOLOCK) ON p.ID = pi.ProcID

JOIN [K2].[Server].[ProcSet] ps WITH (NOLOCK) ON ps.ID = p.ProcSetID

JOIN [K2].[Server].[Act] a WITH (NOLOCK) ON a.ID = wlh.ActID

JOIN [K2].[ServerLog].[ActInstDest] aid WITH (NOLOCK) ON aid.ID = wlh.ActInstDestID AND aid.ProcInstID = wlh.ProcInstID AND aid.ActInstID = wlh.ActInstID

WHERE aid.[User] = 'K2:domainusername'

) 

SELECT * FROM cte

--

then send this task list to the user


Reply