Step by Step Tutorial. Creating workflows with Windows Sharepoint Services and MOSS 2007 (part 13/20). Fixing and running the ASPXCollectFeedback sample (sdk)

 

image

Step by Step Tutorial. Creating Workflows for Windows Sharepoint Services and MOSS2007 (part 13/20). Fixing and running the ASPXCollectFeedback sample (sdk)

 

By Serge Luca

MVP

image 

 
 

Introduction

I’ve received tons of emails related to workflows & aspx forms.

Indeed, I’ve faced many situations where Infopath forms in Sharepoint workflows are not flexible enough or not stable enough; therefore we need the full power and stability of the Asp.net framework (and moreover, some applications need to be based on the free WSS without Infopath Form server).

For instance, many people want to see the history list in the task edit form, they want to use Silverlight in the workflow forms,…  ; I’ve recently worked on a project where the association form must automatically associate several informations to each CreateTask activity, the form uses reflection to retrieve each CreateTask activity…  I’ll show you some other examples in the next posts.

The first natural step for  a Sharepoint developer  is to check the WSS/MOSS sdk to find a good sample. There is a pretty good one , the ASPXCollectFeedback, which unfortunately doesn’t work as expected unless we fix it; that’s what I’m going to do in this post : fixing this sample. I’m very surprised that no one in the Google/LiveSearch universe has complained about this sample (this sample was provided since 2006…). Let’s fix this for the Sharepoint community.

 

Open the solution

Install the downloadable WSS sdk 1.4, backup the projects located in c:\Program Files\2007 Office System developer Resources\ASPXCollectFeedback\ and open the CollectfeedbackWorkflow.sln solution.(fig 1).

ASPXCollectFeedbacklocation

[Fig 1.ASPXCollectFeedback Project location in the WSS 1.4 sdk ]

 

The problems and the solutions

Problem 1. One project (TaskWorkflowContentType) is not compiled by default.

Solution: very easy, right click on the solution property page, select Configuration Properties-Configuration and check the Build option of the TaskWorkflowContentType project (fig 2).

buildsettings

[Fig2.Build options ]

Rebuild the solution.

Problem 2. Gacutil in install.bat

 

  • The sdk sample is based on VS2005 where gacutil was in a different location.
  • Edit the InstallAll.bat file to take the gacutil.exe location into account ("%programfiles%\Microsoft SDKs\Windows\v6.0A\Bin\gacutil.exe"). 
  • Update installAll.bat with your site collection url to the stsadm instructions.
  • Now, run the InstallAll.bat. Normally the workflow and its associated features haven been installed and activated.
  • You can associate the workflow with a list and start the workflow on a list item.

Problem 3.The custom task  form doesn’t show up in display mode

 

  • Indeed when you click on the workflow task, only the standard task list shows up instead TaskWCT.aspx (the custom form) (fig 3).

normaltask

[Fig 3.The standard task form shows up instead of the custom form]

 

  • The reason for this is the Content type manifest file provides only a custom edit behavior , but no custom display behavior.The standard one is used instead.
  • Indeed, if you click on the Edit Item menu, the custom aspx form will show up (fig 4):

customtaskform

[Fig 4.Custom task form]

 

  • To fix this, edit the manifest file TaskWorkflowContentType.xml in the TaskWorkflowContentType project and add a display option (fig 5) :

<Display>_layouts/TaskWFCT.aspx</Display>

ctmanifest

[Fig 5.Adding a custom Display behavior]

 

 

  • Make sure your new content type definition will replace the previous one by deactivating/uninstalling  the existing content type and verify that the old content type is removed it by looking at the content type site gallery.

Problem 4. “Require Manage Lists permission to start the worklow” option is not used :

The association page doesn’t take the “Require manage Lists permissions to start the workflow” option into account (Fig 6).

requirepermList

[Fig 6. This Permission is not  used correctly in the sample]

To fix this, you need to add an additional hidden field in the WFAssoc.aspx page (Fig 7);

<input type="hidden" name="ManualPermManageListRequired" value='<% SPHttpUtility.NoEncode(SPHttpUtility.HtmlEncode(Request.Form["ManualPermManageListRequired"]),Response.Output); %>’>

(More details about this in my next tutorial)

hiddenPerm

[Fig 7. Missing hidden field]

 

  • Run InstallAll.bat and re-associate and test your workflow.
  • In the next post I will describe the project.

Problem 5. The List Content Type case is not handled

Indeed there are 3 kinds of workflow associations:

  1. Workflow association to a list
  2. Workflow association to a content type
  3. Workflow association to a content type in a specific list (this one is missing in the sample)

In the SPWorkfowAssociation class provides  the following methods:

public static SPWorkflowAssociation CreateListAssociation (
SPWorkflowTemplate baseTemplate,
string name,
SPList taskList,
SPList historyList
)
public static SPWorkflowAssociation CreateSiteContentTypeAssociation (
SPWorkflowTemplate baseTemplate,
string name,
string strTaskList,
string strHistoryList
)
public static SPWorkflowAssociation CreateListContentTypeAssociation (
SPWorkflowTemplate baseTemplate,
string name,
SPList taskList,
SPList historyList

Anyway, I will fix this problem in a next post.


This hands-on training is the property of Redwood S.L sprl and may not be organized in class or in group without the prior written permission of Serge Luca. Should you wish to organize this hands-on training in your company or institution, please contact Serge Luca first to enter into a licence agreement. Each trainer or teacher using this hands-on training should have a licence agreement. Please ask your trainer or Serge Luca whether he or she has entered into a licence agreement with Redwood S.L sprl.

The hyperlink to this hands-on training may be placed on your website for free, on the condition that the name Serge Luca is clearly mentioned in the reference. Please send us a mail containing the link to the web page our reference is used on.


Advertisements

One response to “Step by Step Tutorial. Creating workflows with Windows Sharepoint Services and MOSS 2007 (part 13/20). Fixing and running the ASPXCollectFeedback sample (sdk)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s