Hi !
I use the persistence (& tracking) services to save workflows state into a SQL Server database.
When I try to display informations about all workflows in a datagrid, I only get the "system properties" (state, instanceId...)
Other properties are empty.
How can I retrieve all (user) properties ?
(I read related threads but I don't really understand ... the MSDN samples are too complicated and sophisticated: I just want to retrieve some properties, that's all)
- How can I use the TrackingProfile (the MSDN TrackingProfileDesigner project doesn't work for me --> it can't load my workflow properly) ?
- Should I use the TrackData() method in the workflow library, to set user properties that must be accessible by the host ?
- How do I do to get these custom properties when the workflow is persisted (assuming that both persistance & tracking services are ready) ?
What is the minimum code requirements to do that ?
My current code:
CODE
' Récupération des WFs persistés
persisted = WFManager.GetInstance().dbService.GetAllWorkflows()
For Each wfPersisted As WFRH.SqlPersistenceWorkflowInstanceDescription In persisted
If runningOnly Then
If Not wfPersisted.Status = System.Workflow.Runtime.WorkflowStatus.Running Then
Continue For
End If
End If
wf = wfRuntime.GetWorkflow(wfPersisted.WorkflowInstanceId).GetWorkflowDefinition()
row = instTable.NewInstancesRow
row.CompanyId = wf.CompanyId
row.Id = wfPersisted.WorkflowInstanceId.ToString()
row.StartTime = wf.StartTime.ToString()
row.StartUserName = wf.CreatedBy
row.State = wfPersisted.Status.ToString()
row.StopTime = wf.StopTime.ToString()
row.TestId = wf.TestId
row.TestState = wf.Status.ToString()
instTable.AddInstancesRow(row)
row.AcceptChanges()
If sqlDataTrackingQuery.TryGetWorkflow(wfPersisted.WorkflowInstanceId, sqlTrackingWfi) Then
Console.WriteLine(vbLf & "Outputting data tracked from the workflow:" & vbLf)
For Each activityDataTrackingRecord As WFRT.ActivityTrackingRecord In sqlTrackingWfi.ActivityEvents
For Each dataItem As WFRT.TrackingDataItem In activityDataTrackingRecord.Body
' Output data queried from TrackingDataItem table in the database
Console.WriteLine("At the {0} event for the {1}:" & vbLf & "{2} = {3}", activityDataTrackingRecord.ExecutionStatus, activityDataTrackingRecord.QualifiedName, dataItem.FieldName, dataItem.Data)
Next
Next
Else
Console.WriteLine("Could not retrieve data for workflow with instance id {0}", wfPersisted.WorkflowInstanceId)
End If
Next
Thanks a lot !
Etienne