Note: By Default when deleting a document that is associated with a workflow template within Web Publisher you should receive a message saying that the document could not be deleted as it's associated with a workflow.
However, it is possible that the document was deleted outside the web publisher environment possibly using the destroy API.
When you start a workflow within Web Publisher. Web Publisher creates a wcm_change_set object and a folder named supporting docs. The supporting docs folder and the document to be included in the workflow are linked to this change set.
A dm_note object is also created. The dm_note object corresponds to the message entered when starting the workflow. This dm_note object is linked to the supporting docs folder
So, assuming that you have only associated 1 document when starting the workflow. We can run a query to find all change sets associated that only have one object linked to it (by default you would have 2 objects linked to the change set, the Supporting docs folder and the document itself) . From this we can find the workflow associated with it.
Query:
select child_id,parent_id from dm_relation
where relation_name = 'wcm_process_workflow' and
parent_id in (select r_object_id from wcm_change_set where r_link_count = 1)
Note: The child_Id corresponds to the workflow id parent_id corresponds to the wcm_change_set object created
In order to remove the workflow you will then need to issue the Abort API for every child_id returned from the query.
To clean up you may also need to remove the wcm_change_set objects. As the wcm_change_set type is a sub type of dm_folder the r_folder_path will show you where this folder is located.
NOTE: before you remove the wcm_change_set objects you would first need to delete or re-link any objects that are currently linked to them.
No comments:
Post a Comment