When you are working with custom workflows implementing in Visual studio, you might be sending the emails when a task is created. By default SharePoint sends an email when a task is assigned to a user. But, if you want to customize the email body and subject, then you will use send mail activity and will give link to the user. Here the problem starts.
In CreateTask activity in Visual Studio you cannot get the taskID as the task is not yet created. What to do??? So, to get the task identifier we have to implement the below approach.
So, note that in custom workflows which are implementing through Visual Studio the only way you can get the TaskID is AfterProperties of the TaskCreated activity. I have wasted hours when I was learning these. Hope you liked it.
In CreateTask activity in Visual Studio you cannot get the taskID as the task is not yet created. What to do??? So, to get the task identifier we have to implement the below approach.
- CreateTask Activity
- TaskCreated Activity
- SendMail Activity
- OnTaskChanged Activity
- TaskComplete Activity
So, note that in custom workflows which are implementing through Visual Studio the only way you can get the TaskID is AfterProperties of the TaskCreated activity. I have wasted hours when I was learning these. Hope you liked it.
6 comments:
Using this approach means you can only send an email notification for a task when a task is completed. Thats pretty useless if you want to notify users of new tasks.
Hi there,
I am sorry for the mistake. I was typing wrong TaskCreated and TaskCompleted in my post. Now, corrected. Thanks for pointing it out.
The blog was absolutely fantastic! Lots of great information and
inspiration, both of which we all need!b Keep 'em coming... you all do
such a great job at such Concepts... can't tell you how much I, for
one appreciate all you do!
Vinyl Banners
I like this blog very much.Thanks for sharing such a valuable information.
Thanks Pravin for sharing information. I have used CreateTask activity but somehow its not sending email. I have created workflow from SPD and used Send Email action and that worked. What could be wrong ?
First thing as always, check your SMTP [This don't make any sense here as you are saying from SPD it is working.
Second, try to set the task activity send mail option to true.
Third, explicitly use SendMail activity and try to send email.
thanks
-PRaveen.
Post a Comment