We got a requirement to bring back the workflow status for Items which are created 60 days back and Status is changed to “complete” or “canceled “ .
Bcoz normally SharePoint auto cleaner timer job remove the association {everyone knows about this}.
So workflow status disappears for the completed and canceled Items.
Our company wants to maintain the workflow status permanently
So What I have done to resolve this issue is {for the already existing Items}
{In this scenario we have two list one is our main List where the workflow running is called “Customer” and backend list “Workflow History”}
Have created an extra column called workflowName_Status {Hyperlink} to the Customer List hidden the workflowstatus column and written a SharePoint Feature receiver in such a way that
It fetches the Item ID from the Customer list and queries all items for that ID which is Primary ID in the Workflow History {order created descending } based on latest entry Item outcome in the Workflow History list and updating the WokrlfowName_Status column .
In-progress “If latest entry Item outcome not contains any “completed” “
Completed “If latest entry Item outcome contains “completed” ex:wokrlfow_Name Completed
It’s a state machine workflow so when the workflow finishing we are entering the outcome as workflowname_ Completed ”
Canceled “If latest entry Item outcome contains any “canceled by user option””
And Am providing link to the Workflow History list for that purpose have created a view with the required fields in it.
For the New items added I have followed a different approach
Everything is working fine at this moment
I would like to know is this the best way to handle such scenario
Please help
Thanks in advance .