Wednesday, December 15, 2010

Task Item Id In Workflows

Some may want to send the task link in email to their approvers. At that time, either we may need to use OnTaskCreated activity. this activity may fire sometimes, may not @ some moment throwing event delivery failure exception.

So how to get the task item id?
Answer is very simple! Just open workflow designer; there click on Create Task Activity, open properties. You can see one thing called TaskItemId with value -1. Assign a new field.
Now check the value of that field after create task activity. You will be getting the value of task item.

But one bad thing is, you can't obtain the reference to it. It simply gives taskitemid but if you try to obtain the item instance, it will throw an exception. According to my guess, it gives item id then creates item!!!