After googling for hours I came to an answer that rather to trigger any workflow event we can attach an event receiver (i.e. Item Added) to workflow history list. And in ItemAdded() method we can perform the task. In my case, if the workflow is cancelled then I want to reset the permission of workflow item.
So the declaration for event receiver would be as below:
<Receivers ListUrl="Lists/Workflow History">
The coding for event receiver will be as follows:
public override void ItemAdded(SPItemEventProperties properties)
SPListItem addedItem = properties.ListItem;
// getting web.
SPWeb web = properties.Web;
// getting qms document library.
SPList List = web.Lists[ListTitle];
if (List != null)
// getting the list id from added item.
Guid listId = new Guid(Convert.ToString(addedItem["List"]));
// check if the history item is for qms documents
if (List.ID == listId)
// getting the event type of the workflow.
int EventType = int.Parse(Convert.ToString(addedItem["Event"]));
// if the event type of workflow is cancelled then break unique permission and inherit it's parent.
if ((SPWorkflowHistoryEventType)EventType == SPWorkflowHistoryEventType.WorkflowCancelled)
// getting the list item.
SPListItem Item = List.GetItemById(Convert.ToInt32(addedItem["Item"]));
// remove unique assignements.
catch (Exception ex)
I think this might help others too!!!