SPD Workflow “Collect Data From A User”: Modify the Generated Task Form

I’m working on a project that uses five different SharePoint Designer work flows to handle some document approvals.  SPD provides the "collect data from a user" action so that we can prompt the user for different bits of information, such as whether they approve it, some comments and maybe ask what they had for dinner the other night.

The forms are perfectly functional.  They are tied to a task list as a content type.  They are 100% system-generated.  This is their strength and weakness.  If we can live with the default form, then we’re good to go.  However, we don’t have too much control over how SPD creates the form.  If we don’t like that default behavior, we need to resort to various tricks to get around it (for example, setting priority on a task). 

I needed to provide a link on these task forms that opened up the view properties (dispform.asxp) of the "related item" in a new window.  This provides one-click access to the meta data of the related item.  This is what I mean:


Thankfully, we can do that and it’s not very hard.  Broadly speaking, fire up SPD, navigate to the directory that houses the workflow files and open the ASPX file you want to modify.  These are just classic XSL transform instructions and if you’ve mucked about with itemstyle.xsl, search or other XSL scenarios, this will be easy for you.  In fact, I found it to be generally easier since the generated form is somewhat easier to follow as compared to a search core results web part (or the nightmarish CWQP).

Of course, there is one major pitfall.  SPD’s workflow editor expects full control over that file.  If you modify it, SPD will happily overwrite your changes give the right set of circumstances.  I did two quick tests to see how bad this could get.  They both presuppose that you’ve crafted a valid SPD workflow that uses the "collect data from a user" step.

Test 1:

  • Modify the ASPX file by hand.
  • Test it (verify that your changes were properly saved and didn’t break anything).
  • Open up the workflow and add an unrelated action (such as "log to history").
  • Save the workflow.

Result: In this case, SPD did not re-create the form.

Test 2:

  • Do the same as #1 except directly modify the "collect data from a user" action.

Result: This re-creates the form from scratch, over-writing your changes.

Final Notes:

  • At least two SPD actions create forms like this: "Collect Data From a User" and "Assign To Do Item".  Both of these actions’ forms can be manually modified.
  • I was able to generate my link to dispform.aspx because, in this case, the relate item always has its ID embedded in the related item’s URL.  I was able to extract it and then build an <a href> based on it to provide the one-click meta data access feature.  It’s unlikely that your URL follows this rule.  There may be other ways to get the ID of the related item but I have not had to cross that bridge, so I don’t know if gets to the other side of the chasm.
  • I didn’t investigate, but I would not be surprised if there is some kind of template file in the 12 hive that I could modify to affect how SPD generates the default forms (much like we can modify alert templates).


Subscribe to my blog!

Technorati Tags: ,

4 thoughts on “SPD Workflow “Collect Data From A User”: Modify the Generated Task Form

  1. Jim Bob Howard


    Good information. I would like to add a scenario that recreates the form:

    Test 3:

    <li>Do the same as #1 except change the name of the Workflow (click the <Back button to get to the "Define your new workflow" page).</li>

    Result: SPD renames the directory that contains the workflow and the forms. Because it is creating it in a "new" directory, the form is recreated from scratch, over-writing your changes.

  2. No name

    http://www.batteryfast.co.uk/compaq/310924-b25.htm compaq 310924-b25 battery,
    http://www.batteryfast.co.uk/compaq/pp2162s.htm compaq pp2162s battery,
    http://www.batteryfast.co.uk/compaq/pp2160.htm compaq pp2160 battery,
    http://www.batteryfast.co.uk/compaq/n150.htm compaq n150 battery,
    http://www.batteryfast.co.uk/compaq/n200.htm compaq n200 battery,
    http://www.batteryfast.co.uk/compaq/n620.htm compaq n620 battery,
    http://www.batteryfast.co.uk/compaq/pp2111x.htm compaq pp2111x battery,
    http://www.batteryfast.co.uk/dell/inspiron-6000.htm dell inspiron 6000 battery,
    http://www.batteryfast.co.uk/dell/inspiron-9200.htm dell inspiron 9200 battery,
    http://www.batteryfast.co.uk/dell/inspiron-9300.htm dell inspiron 9300 battery,
    http://www.batteryfast.co.uk/dell/inspiron-9400.htm dell inspiron 9400 battery,
    http://www.batteryfast.co.uk/dell/e1705.htm dell e1705 battery,
    http://www.batteryfast.co.uk/dell/m1210.htm dell m1210 battery,
    http://www.batteryfast.co.uk/dell/nf343.htm dell nf343 battery,
    http://www.batteryfast.co.uk/dell/1210.htm dell 1210 battery,
    http://www.batteryfast.co.uk/dell/cg036.htm dell cg036 battery,
    http://www.batteryfast.co.uk/dell/t6840.htm dell t6840 battery,
    http://www.batteryfast.co.uk/dell/latitude-x1.htm dell latitude x1 battery,
    http://www.batteryfast.co.uk/dell/xd187.htm dell xd187 battery,
    http://www.batteryfast.co.uk/dell/inspiron-1300.htm dell inspiron 1300 battery,
    http://www.batteryfast.co.uk/dell/inspiron-b120.htm dell inspiron b120 battery,
    http://www.batteryfast.co.uk/dell/inspiron-b130.htm dell inspiron b130 battery,
    http://www.batteryfast.co.uk/gateway/m680.htm gateway m680 battery,
    http://www.batteryfast.co.uk/gateway/m360.htm gateway m360 battery,
    http://www.batteryfast.co.uk/gateway/m460.htm gateway m460 battery,
    http://www.batteryfast.co.uk/hp/m2000.htm hp m2000 battery,
    http://www.batteryfast.co.uk/hp/dv1000.htm hp dv1000 battery,
    http://www.batteryfast.co.uk/hp/dv4000.htm hp dv4000 battery,
    http://www.batteryfast.co.uk/hp/ze2000.htm hp ze2000 battery,
    http://www.batteryfast.co.uk/hp/hstnn-db17.htm hp hstnn-db17 battery,
    http://www.batteryfast.co.uk/hp/n6000.htm hp n6000 battery,
    http://www.batteryfast.co.uk/hp/n6100.htm hp n6100 battery,
    http://www.batteryfast.co.uk/hp/f2019.htm hp f2019 battery,
    http://www.batteryfast.co.uk/hp/f2019a.htm hp f2019a battery,
    http://www.batteryfast.co.uk/hp/f2019b.htm hp f2019b battery,
    http://www.batteryfast.co.uk/hp/hstnn-db02.htm hp hstnn-db02 battery,
    http://www.batteryfast.co.uk/hp/dp399a.htm hp dp399a battery,
    http://www.batteryfast.co.uk/hp/383968-001.htm hp 383968-001 battery,
    http://www.batteryfast.co.uk/hp/f1739a.htm hp f1739a battery,

  3. Kirsten

    Thanks for this it is just what I am looking for!

    I have collected some data from a user in a SharePoint Designer workflow step and I now want to display that data in a second “Collect Data from User” form at a subsequent step in my workflow. How can I add the content of my Workflow data variable in the Collect Data from user form?

    Could you please show the code that you use to achieve this?

    1. Paul Galvin Post author

      Sorry for never responding. I’m doing a giant blog cleanup process now and I apologize for missing you. I hope you figured out a good solution.


Leave a Reply

Your email address will not be published. Required fields are marked *