I have a web part that users use to initiate some processing which could take up to an hour to finish (it involves processing a lot of list items). If I start this processing on button click in standard server side code then obviously it times out. I am thinking of following options:

  1. Create an item in a new list with details of what to process and trigger a workflow on that list that will run in background. Workflow can keep updating the progress in list item that I can show on web part if user refreshes the page. Here the question is Can a workflow keep running for an hour or so? Is there any time limit or something else that can make it to stop?
  2. Trigger a timer job to do the same work. Again, any time limits for timer job
  3. Write a web service and invoke it from client side. I will get all list item Ids to process first and then invoke from JavaScript in batches and report progress on UI

Looking for pointers on how best to handle this kind of scenario and pros/cons of various approaches. Goals are:

  • Reliably complete the processing even if it goes on for hours
  • Ability to track progress of background work
  • Preferably a way to stop and restart the process from where it was stopped


  • I hope the person who voted this down will be honest enough to provide a reason. This is a situation I have faced in a live project and I believe I have described the details clearly.
    – Prakash
    Commented Mar 18, 2016 at 12:36

1 Answer 1


Sure workflows can run for days, but IMO any workflow is expected to reflect some business process, and should not be used just as a code execution environment. However if you choose to use workflow, I'd create a hidden list, setup a workflow triggered on item creation at that list, and create on item with all needed metadata when user clicks a button at webpart. Make a Progress column and update item's progress from the workflow, to just query a value in the webpart.

Timer jobs have schedules. And basically it's "1 job definition + 1 schedule = N timer jobs" logic. Repeating the same task over and over depending on time. And you say you want users to trigger it - does it mean it depends on user / date&time / any other external parameter? We can't pass parameters to timer jobs. I don't think you'll want to end up creating a new timer job definition each time just to run it once. However if you choose to use timer job, I'd define a timer job that runs every X minutes and reads new items in queue list (that are added from webpart) and processes them one by one. Like in the workflow scenario, but performance and control is much better.

But I'd stick to custom development here. Maximum control, you know.

  • thanks for the detailed reply. For timer jobs, my idea was just as you describe, run it every X minutes and check for new items to process from queue list. I was just trying to see if there are any obvious benefits compared to workflows. In a way, there is not much difference here between workflows and timer jobs and both are not directly meant for this kind of functionality. So the question really is what is the most suitable way to implement this.
    – Prakash
    Commented Mar 1, 2016 at 12:09
  • When used to run utility things, workflows show poor performance compared to code, non-trivial flow control (no loops in SDP until 2013!), lack of required activities out of box. For any complex task Nintex/K2 workflow is better than SDP one, but those cost money. VS workflows are an option, but if you code, then why not plain code C#, right? There are a lot of Q's here like sharepoint.stackexchange.com/questions/62161/… that you would like to avoid Commented Mar 1, 2016 at 12:39
  • your answer is more on implementation details, I am not looking for that. I am interested in knowing the approach/design for this kind of functionality. Thanks to taking out time to answer.
    – Prakash
    Commented Mar 1, 2016 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.