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.
- 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.
- 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.
- 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!