3

The problem is the following: I need to create a workflow using sharepoint designer, which will create tasks for chosen users and after, will send them email notifications, where every email will contain url of the corresponding task edit form. I made this functionality using "Task process" workflow activity. In this activity there is a way to put task view form URL in emails([%Current Task:URL%]), but how to get edit form url or at lest how to get task id in sharepoint designer I couldn`t find.

Any ideas? Is there a way to insert task edit form URL to notification emails without coding?

3 Answers 3

4

Not sure if anyone's paying attention to this question anymore, but I just had the same issue. I had been using the "Start a Task Process" activity in the workflow, but I wanted to link the user directly to the edit page. Normally, the email contains a link to the view properties page for the task (i.e., the [%Task:URL%] variable). But then users need to know enough about what's going on to click the edit task link somewhere and then finally approve or reject.

Instead of using the "Start a Task Process" activity, use the "Assign a Task" activity. That will provide the ID of the created task and allow you to construct the URL of the edit page using that ID (which will be a standard workflow variable, accessible from anywhere in the workflow once the task is created), e.g., set your hyperlink target in the string builder to something like

http://yourserver/sites/somesite/Tasks/Forms/EditForm?ID=[%Variable:TaskID%]
2

I have the same problem. I ended up with a solution where I insert a link to the dispform, but suffixed with &linkfromemail=true. On the dispform page I have a hidden content editor web part, where source is edited to contain the following javascript, which forwards to editform:

<script> 
function qsSearchInUrlString(key) {
 key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars
 var match = location.search.match(new RegExp("[?&]"+key+"=([^&]+)(&|$)"));
 return match && match[1].replace(/\+/g, " ");
}

if (qsSearchInUrlString("linkfrommail")!=null) {
 var theId = qsSearchInUrlString("ID"); 

 var infix = "/Opgaver/DispForm.aspx";//this relative path for the task library and dispform.
 var indexOfInfix = location.href.indexOf(infix) +  1; 
 var editUrl = location.href.substring(0, indexOfInfix) + "Opgaver/EditForm.aspx?ID=";
 var newUrl = editUrl + theId; 
 location = newUrl;
}
</script> ​​​​
1

If you look at the Task list which you are storing the task then you can get the URL of the EDIT form and then add that into your workflow with the required (task) ID.

So in effect the URL of the form is hard-coded in the email but has the variable of the TaskID attached to it.

S

10
  • Yap, but there is still a problem - how to set taskID variable. In Task Properties picklist there is no such a variable. Commented Mar 18, 2013 at 12:49
  • I thought you were using %Current Task:ID%?
    – Stephen
    Commented Mar 18, 2013 at 12:55
  • I would like to use it, but it is not available in the list of available fields. Screenshot - dropbox.com/s/qj3rtileq6tdt1j/spw.png Commented Mar 18, 2013 at 13:04
  • And there is one more property - "Task Assignee". Commented Mar 18, 2013 at 13:07
  • Just fixed question, there mus be URL, not ID. ID is giving exception in SharePoint. I tried to write it manually before. Commented Mar 18, 2013 at 13:12

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.