none
Direct user to Edit form when assigning a task RRS feed

  • Question

  • Hello,

    I am trying to direct a user to the edit form of a task when I use the "Assign a task" action in SharePoint Designer 2013.  For some reason it seems that the ID is not available at the time of the email being sent.  However, this doesn't really make sense because somehow the Task URL (to the display form) is available, and the URL must include the ID to take the user to the correct item. 

    Here is a screenshot of the task options:

    None of the "Field from source" options have "Task Related Item ID".  Okay, so I'll try old school style like I did in SP07.  So I tried manually making my own link to the edit form and I selected the task ID myself through the "Add or Change Lookup" button.  I selected the Tasks list as the list I want data from, and I select the ID as the field I want returned, where the ID in the task lists matches the variable of the TaskID which should be created once this task is created.

    Unfortunately this causes a problem as well. This config causes the workflow to suspend with the error below.

    RequestorId: 3a416983-eb99-9b0e-0000-000000000000. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ArgumentNullException: Value cannot be null. Parameter name: String at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at Microsoft.Activities.Expressions.ParseNumber`1.Execute(CodeActivityContext context) at System.Activities.CodeActivity`1.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

    So how exactly is it that the value is null when I try to use ID, but the option for Task Properties - Task Related Item URL (which includes the ID) is somehow fine.  I assume getting the ID isn't possible because the task hasn't been created yet but somehow Microsoft was able to pull off this magic where the ID is known at the time of creating the URL to the DisplayForm.

    Just as a side note, I know this has already been questioned on this thread here.  However, the proposed solution of re-directing the DisplayForm to the EditForm is not the most elegant way of doing this.  Maybe there are times where certain properties of the task need to be displayed instead of forcing the user to the edit form every time.  Maybe some people don't like being redirected without their consent.

    Does anyone know of a more elegant solution?

    Does anyone agree that Microsoft really should allow us to use the task ID in the task emails?  In fact, maybe it would be nice to also have a Task Properties - Task Related Item URL (EditForm) and a Task Properties - Task Related Item URL (DisplayForm) for convenience.  (We were given the DisplayForm option, I just listed it for clarity on the suggestion).

    Thanks,

    Eric

    Tuesday, June 27, 2017 11:26 PM

All replies

  • Hi Eric,

    The “[%Variable: TaskID%]” will be set value after the “Assign a Task” action is completed. And there is no OOB method to get the ID from the “[%Task: URL%]” in the email body.

    As a workaround, we can create a workflow for the associated workflow task list. When a task is created, send an email with the path to the assigned user.

    Best Regards,

    Linda Zhang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Proposed as answer by croute1 Wednesday, June 28, 2017 3:06 PM
    • Unproposed as answer by Eric Sammann Wednesday, June 28, 2017 6:40 PM
    Wednesday, June 28, 2017 6:34 AM
    Moderator
  • Hi Linda,

    Thank you for the reply.  However, I don't think this would really work for me.  The action to "Assign a Task" automatically sends an email, so putting an email notification on the task list would result in duplicate email messages for every task assigned to the approver.  This would really make things more confusing.

    In addition, the "Assign a Task" action includes the ability to send overdue emails (nice).  The reminder emails also do not have access to the related item ID (boo).  If I did what you suggest and I develop my own workflow on the task list for the notification and reminders, then I'm not sure how I would communicate back to the first workflow once the approver completed his task and the second workflow was done.

    So in short I see 3 problems with creating my own notification and reminders.

    1. How to stop the initial email from the "Assign a Task" action (not possible from what I can tell)
    2. How to send reminders on a schedule (doable but sucks that I can't just use "Assign a Task" features)
    3. How to communicate back to the first workflow that the task is complete.  (maybe possible with wait for event, but now I feel like I'm going so deep in the rabbit hole that I would be better off not going this route)

    If I were to go this route then I would have to create two workflows for every approval workflow, and I have about a dozen of these that I have to make on different sub-sites (separated because of permissions requirements) all because I don't have the ID when sending the email from the "Assign a Task" action.

    BTW, you mentioned that the ID is not known at the time the task is created

    The “[%Variable: TaskID%]” will be set value after the “Assign a Task” action is completed

    However, somehow it is known before the action is 100% complete because the ID is sent out in the notification email and the reminder emails as a part of the URL.  The action must be creating the task and then getting the ID for use in that URL.  It would be really nice if MS would just give us access to that ID as well in case we want to customize the URL to our preferences (such as EditForm instead of DispForm, or maybe changing the "Source" query string variable, or maybe something else)

    Thanks,

    Eric

    Wednesday, June 28, 2017 6:40 PM
  • Hi Eric,

    Yes, the ID of the task will be known at the time when the task is created. But the output Variable: TaskID will set value after the Assign a task action completed. So that, if we use the Variable: TaskID in the email body, the value is null.

    As a workaround, we may need to deploy a custom workflow action.

    Information about how to build workflow custom actions:

    https://dev.office.com/sharepoint/docs/general-development/how-to-build-and-deploy-workflow-custom-actions

    Best Regards,

    Linda Zhang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Friday, July 7, 2017 7:04 AM
    Moderator