not certain which fields to use in Define Workflow Lookup RRS feed

  • Question


    I have a workflow used to collect information from users making travel requests. It uses a custom task form and the "collect data from user" action and is submitted in sequence to three managers for approval. What I am trying to do is send an custom email message with a link to the "task" as it is assigned to each magaer by appending the "TaskId" to the end or a url in a href.

    The problem is that I am not sure which fields and what order to select them in the "Define Workflow Lookup" within the email body. Form what I have read it should be simply

    Source: Current Item

    Field: ID

    However this does not return the TaskID number. It returns the Form:ID which does not get you to the task when the link is clicked in the email.

    I am not sure what sequence I should follow under "Define Workflow Lookup" to get the actual id of the task.

    Any help with this would be greatly appreciated.

    Wednesday, July 16, 2008 5:47 PM

All replies

  • When you do as "Collect Data from user",ut returns a value which is put into a variable that you specify.  This is the Task ID.


    You will see that this variable is of type "List Item ID".  I always name these return variables with "ID" on the end, so that I do not forget.


    So, in the workflow lookup, select "Workflow Data", and the variable mentioned above. This will have the correct Task ID.

    Wednesday, July 16, 2008 7:52 PM
  • HI Mike,

    Thanks for taking your time to answer. I must be doing something wrong. When I use the "add lookup to body"  then select "workflow data" and select source: workflow date and field: "variable id  of first approver" and add this to the end of the url, when you click the link within the email it returns a "0".

    I am probably be missing something.

    any additional help would be greately appreciated.


    Wednesday, July 16, 2008 9:58 PM
  • I don't think you can do what you want in that way.


    Collect data is a blocking action, so even though you get back the task ID, you don't get it until after the task has been completed.


    I think your best bet is to send the email using a workflow attached to the task list itself.  It should have all the data you need to construct the link.




    Thursday, July 17, 2008 10:43 PM
  • Oops! Thank you. The environment where I am working is set up to send automatic email notifications of Tasks. Although I rely on this facility, I thought that I could give a quick answer to the question (mainly because I couldn't recall what steps are needed in SharePoint Administration).


    Paul is perfectly correct - the instruction to send the email only executes after the Task is marked as complete.  if you can't get automated emails done, then do as he says and write a separate workflow on the Tasks List, using the Assigned To field for the recipient, and the URL field for the link to the Task.

    Friday, July 18, 2008 6:11 AM
  • Thank you both. I see what you are talking about. I had tried to create a second workflow to send the email notifications for me.

    I have tried the second workflow method and here is the problem I had with it.

    I have a workflow created in Sharepoint Designer to request authorization for travel. It uses a custom form (Travel Request) to gather information from the requestor using “Collect data from user”. There are 3 approvals required for travel. This all works fine.

    I have a second workflow running on the “Task list” that is supposed to send a custom email notification to the 3 approvers required for travel (This runs in sequence) Approval is required by each level before the next level is notified.

    Based on an instructional video from Microsoft I set the second workflow up like this. (Conditions and Actions)

    If Content Type = First Approver

    Set Variable: Approver Variable to First Approver

    If Content Type = Second Approver

    Set Variable: Approver Variable to Second Approver

    If Content Type = Third Approver

    Set Variable: Approver Variable to Third Approver

    Then I have an email set up with a hyperlink to the approval location and am trying to use the variable to assign the correct approver.

    I use the Task:ID to get the correct task number and this works fine. My problem comes from the fact as the workflows steps through each task the “Approver Variable” never changes resulting in an email notification that returns the same url ignoring the fact it should change with each step.


    Approverlist/first approver.aspx=?ID21

    Approverlist/first approver.aspx=?ID22 instead of Approverlist/Second approver.aspx=?ID21

    Approverlist/first approver.aspx=?ID23 instead of Approverlist/Third approver.aspx=?ID21

    In spite of what I learned from the tutorial “content Type” does not work here. But nothing I have tried returns the correct information either.

    Any help would be greatly appreciated.
    Friday, July 18, 2008 2:57 PM

    I have a separate workflow running on the task list.

    I set the first condition to:


    If Assigned to equals Task:Assigned to and define the workflow lookup as follow

    Set Variable: Special URL Variable to 1st Manager Approval


    Source: Tasks

    Field: Assigned to


    Find the list item

    Field: Tasks: 1st magaer approval


    And the two remaining conditions are set accordingly.


    When the workflow is run the 1st manager approval is put in the email notification and you are able to click the link to reach the approval page.

    But the problem that occurs and I don't know who to get rid of is this. The workflow runs on through adding the correct task number but the only name that is added to the url is "1st manager approval".

    what i need is to get 2nd manager approval assigned to teh second approval task etc. any thoughts on what I am doing wrong?




    Monday, July 21, 2008 7:13 PM