I have a list called "Sessions", The list has a workflow which runs for item creation, modification. The workflow triggers when i add items using a web part as well as manually . I have developed a timer job which runs daily, which adds items to "Sessions" list. When timer job add items to the list, workflow does not trigger.
SharePoint timer job add list items, but does not trigger the associated workflow
1.4k views Asked by Prasad Madushanka At
1
Creating or editing a list item using the API will not trigger workflows. You have to use the
SPWorkflowManagerclass to trigger it yourself. Every instance ofSPSitehas a property of just that type, which is what you should use.You could code it like this:
Where
itemis the SPListItem which you have created/edited,associationis the instance ofSPWorkflowAssociationthat correlates the list to the actual workflow, andisAutoStartis abooleanvariable telling the workflow manager whether the workflow trigger should behave as something that was started automatically (in your case,true).