I'm developing Sharepoint 2013 Workflow in Visual Studio and I need to get ID of a task that is created by Single Task activity and write it to list item's field. What's the best way to achive this?

3 Answers 3


SingleTask activity returns TaskItemId which you can store in a variable and use it in UpdateListItem activity afterwards.

  • Sorry, Slaven, but I cannot use this variable before task is ended, because workflows moves to the next step only after task is complited. And I need TaskItemId to be at SPListItem's field before task is complited...
    – Chetvergov
    Oct 30, 2014 at 7:40
  • I suppose you need the task ID the moment after it is created. Can you add event receiver to Workflow task list and do your logic there? Oct 30, 2014 at 8:19

I know this is a bit late answer but it will definitely save others' time. If you want to get the task id to send on email notification (for instance) before the task is ended, best approach I found is in this article: customize task approval email to include link to respective task

I tried it myself and working like a charm


There is some documentation, basically since Sharepoint is not syncronous you need to commit changes or add pauses to give it time. That way you can make sure the value is available when you need it


Hope you can find this useful

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.