Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

onWorkflowItemDeleted - delete workflow on item deleted

$
0
0

Hi,

Our SharePoint site uses a special template, and even if I delete an item, I can see that the counter of running workflows stays the same (not the case when the workflow is completed).

The strange thing is the workflow is correctly deleted in my development environment, not in production.

So I added a event Driven (State machine workflow) and a onWorkflowItemDeleted.

        private void onWorkflowItemDeleted_Invoked(object sender, ExternalDataEventArgs e)
        {
            try
            {
                SPWorkflowManager.CancelWorkflow(workflowProperties.Workflow);
            }
            catch (Exception ex)
            {
                LogComment(ex.ToString());
            }
        }

but it still does not delete the workflow...

What should be a fix?


Viewing all articles
Browse latest Browse all 11508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>