To catch the onItemChanged event of any Sharepoint list in a workflow, the following needs to be done:
- Add a CallExternalMethod Activity, set the interface to Microsoft.SharePoint.Workflow.IListItemService
- Set the method name to InitializeForEvents
- Bind the ItemId, ListId to ItemID and ListId in the workflow properties.
- Add a HandleExternalEvent activity and specify the following properties:
InterfaceType to Microsoft.SharePoint.Workflow.IListItemService
Event Name : OnItemChanged
NOTE: The correlationToken should be the same as the correlation token specified for CallExternalMethod activity.
Method Name. This method will be called whenever there is a change in the list item. - Bind the ID property to a field. Initialize this field to a new GUID.
- This will capture the onItemChanged event.