3

I have developed a Visual Studio 2012 workflow for SharePoint 2013.

I am trying to find a way to simply send a link to the actual Task in the Assignment email. I have created a variable and set the "TaskItemId" in the output sections of the properties to that variable.

I then reference my variable in the body of the AssignmentEmailBody property. When the email gets sent the TaskID is null. In sharepoint designer there is a "Start Task Initation Process". I am guessing it creates the task first, returns the ID and then moves on to everything else.

Does anyone have ideas on how to solve this?

2
  • This is actually a very good question. I have the exact same problem!
    – David
    Aug 28, 2013 at 15:09
  • I also need an answer on this. Anyone?
    – Muhammedh
    Nov 26, 2014 at 6:42

2 Answers 2

2

Found out a solution... SharePoint 2013 provides something called the TaskEmailToken. The values are changed in the runtime. So if you want to add a link that will take you to the task page, add the below mentioned html element to the email body in the task.

<a href='%TaskSpecial: TaskUrl%'>Open Task Page</a>

Hope this was helpful.

0

The reason you cannot get the TaskID using the Task Output variable TaskItemId is because this Variable is set after the task has been completed (either approved or rejected). The only way to get a link related to your task is using Email Tokens that Muhammedh mentioned above. There are other fields you might want to get related to your task, and you will get the same problem if you try to get the value using variables and using them in your email. You can find the email tokens in the next MSDN page: https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflowservices.activities.taskemailtokens_fields.aspx . Remember this is the only way you can get these values when the task Email is generated. SharePoint designer allows you to use these fields through a nice UI combobox but if you are working with Visual Studio Tools you need to define something like this:

This is an example inside my Task email template Body:

enter image description here

I hope this explanation helps you all colleagues.

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.