Skip to main content

I know that you can pull datafields from active processes via the Workflow.Client, but this only works with Active processes.
                    ...
                    For Each dataField In worklistItem.ProcessInstance.DataFields
                        If dataField.Name = "ASDF" Then
                            Response.write(dataField.Name.ToString + ": " & dataField.Value.ToString)
                        End If
                    Next
                    ...
How can I get that same datafield value after that process is completed?  I tried using the Workflow.Management, but I haven't figured out if this is the correct approach as it seems to only expose certain predefined items.
                    Dim allProcInsts As ProcessInstances = workflowserver.GetProcessInstances()
                    For Each proc As SourceCode.Workflow.Management.ProcessInstance In allProcInsts
                       If proc.ID = K2ProcID Then
                          Response.Write("Process ID: " + proc.ID.ToString + "<BR>")
                       End If
                    Next

 Any Thoughts?

 

You can't access this data from either the K2 Management or K2 Client API's. You can use the reporting SmartObjects which come with K2 blackpearl to access this data however. The relevant path to the process data SmartObject is "Workflow ReportsWorkflow GeneralProcess Data" and you'd call the List method and pass in the process instance id of the process you need the data from (you can get the id from one of the other SmartObjects such as the Process Instance SmartObject.


 Hope that helps.


 


FYI, to expand on cmurphy54's suggestion, there is a post here (http://k2underground.com/blogs/fromthebench/archive/2008/06/02/how-to-retrieve-process-instance-reporting-data.aspx)that shows how the Reporting SmartObjects can be interacted with programatically.  The specific example within this referenced post uses a different SmartObject, but you should be able to use it subsituting in the SmartObject that cmurphy54 mentions above.

HTH.

 


Reply