You’ve got Questions (About Workflow), here are the Answers

Thank you to everyone who joined the Workflow web cast on Wednesday. My apologies for the somewhat abrupt ending to the call as the telephone I was speaking on dropped. However, as promised, please find my responses to the questions that were asked.

Q: If the WSS Workflow is 3 steps, is that the same for MOSS?
A: No, The OOB MOSS templates for approval isn’t constructed the same.

Q: What are the maximum number of steps that you can have in a workflow?
A: I don’t know what the specific number is but it’s more than would be practical to have in a workflow.

Q:What is the best practice for generating workflows that can be upgraded?
A: If it’s a bug fix, you can recompile the DLL and redeploy. You’ll need to temporarily stop the web site, the timer service, and the administration service to redeploy the file into the GAC. If you’re deploying an updated workflow with new steps, it’s best to deliver a new workflow – and let the current instances of the old workflow die off.

Q:Is there a way to edit and modify the out-of-the-box templates with Visual Studio?
A: Unfortunately, No. You can only create new workflow templates not modify the out of the box templates.

Q:SharePoint is the host for my workflows, how can I get a direct handle to the WorkflowRuntime to get notified on WorkflowStarted, etc.?
A: No, SharePoint has to manage the runtime. There’s no facility to get access to the runtime.

Q: When will the Visual Studio Extensions for Windows SharePoint Services be available for Visual Studio 2008?
A: It was announced at TechEd 2008 | North America this week, that the VSeWSS Version 1.2 (which supports VS2008) will be available by next Monday.

Q: What’s the difference between a pure WF workflow and a SharePoint WF?
A: The biggest difference is a SharePoint WF begins with a specific OnWorkflowActivated activity that wires things up. You also get access to a larger set of out of the box activities, and the details around hosting the WF runtime are handled for you.

Q: Why do workflows have to go in the GAC?
A: It’s complicated but essentially it has to do with being able to find and load the DLL running from different contexts.

Q:How do you activate/deactivate a workflow that is deployed to all of the site collections in a web application?
A: There’s no out of the box way to do this. However, the code is relatively trivial. See the below…

public static Sample(Guid featureDefId, string Url)
using (SPSite site = new SPSite(Url))
SPWebApplication webApp = site.WebApplication;
foreach (SPSite webAppSite in webApp.Sites)
webAppSite.Features.Add(featureDefId, true);

Q: How would you migrate custom workflows across SharePoint Farms?
A: Packaging the workflow template in a SharePoint Solution (WSP) file would allow you to deploy the template across farms. Workflows created in SharePoint Designer cannot be migrated.

Help Your SharePoint User

Q: Can you hide fields that you’re using to manage approvals?
A: Yes, absolutely. When you define the field you set HIDDEN = True as an attribute of the <Field> tag.

Q: Can you allow something to be approved by three people?
A: Yes, either by specifying a group or by using the Repeater and creating one task for each of the three people. The out of the box MOSS Approval workflow is a good way to see some of the options.

Q: I want to bulk upload documents and parse out some metadata. Should I use a Event Receiver or a Workflow?
A: Event Receiver. Event Receivers are quicker and lighter weight. IF you don’t need human interaction or a long running scenario, event handlers are a better choice?

Q: What type of list is being used for the workflow tasks?
A: It’s a standard tasks list. The workflow runtime automatically associates your content type with it.

Q: Where will the source code from this presentation be available?
A: At

Q: Is it possible to have a global view of all instances of running workflows in SharePoint?
A: Not easily and certainly not out of the box. You would have to build this yourself.

Q: Where do you do the strong naming of an assembly in Visual Studio 2008?
A: Project properties, just like in VS 2005.

Q: What security credentials is the workflow processing under?
A: It’s actually running under the application pool account for the web application that hosts the workflow, however, it’s made to look like the current user as much as possible. From a security management perspective you must be careful about what code is allowed to run as a workflow because it’s a highly privileged token that it can get to.

Q: What do you think about third party workflow offerings?
A: They have their place. Building Visual Studio workflows can be difficult. Third party tools make that process easier.

Q: Does the type for a workflow task need to be assigned to the task list the user chooses?
A: No, SharePoint will add the content type to the workflow tasks list.

Q: How do you find the ID of the new custom task content type?
A: You don’t, you define the content type via a feature so that it doesn’t change.

Q: Are you using a workflow task list?
A: It’s a regular task list. SharePoint added the content type for me.

Q: Can I use workflows with Outlook Tasks?
A: No, they have to be SharePoint tasks, however, the normal SharePoint to Outlook integration rules appy.

Q: Is InfoPath required to create the workflow forms?
A: No, you can also code them in ASPX (Visual Studio) if you would like.

Q: Can an Activity’s properties can be shared between different workflows?
A: No, however, with activity binding they can be shared between two different activities in the same workflow instance.

Q: Is there an online community site with prepackaged workflows for common scenarios?
A: I’m not aware of any.

Q: Can you develop a custom activity in Visual Studio and then use it within SharePoint Designer?
A: Yes, that’s my final example in my talk this morning on developing Custom Workflow Activities at TechEd 2008 North America. Basically you have to add an authorizedType entry into the web.config and create a .ACTIONS file and add that to the server.

Q: Can you debug a workflow?
A: Yes, you can attach to the IIS worker process with Visual Studio. Just make sure that you only attach the workflow debugger. It has the CLR debugger pieces in it. The SQL debugger conflicts so it should definitely be removed.

Q: Can you debug a SharePoint Designer workflow?
A: Not to my knowledge.

Q: Can a workflow access an external database?
A: Sure. It’s standard .NET code that’s running inside the activities.

Q: How can I handle the cancel event if the user is clicking the “Terminate Workflow Now” link on the status page?
A: If you right click on the white area in the workflow designer you’ll see options for fault handlers and cancel handlers (or whatever the specific text is.) They can be used to handle “extordinary” flow events like the workflow being cancelled.

Q:What’s the best practice for starting workflows on SharePoint Surveys?
A: I’ve never tried it. I’d suspect the standard rules apply. I don’t recommend having both Automatically start on Creation and Automatically start on Change… but other than that I don’t think that there are many “best practices”

Q: Can you break down the content type for a workflow task again?
A: Sure. The ID is 0x010801. The first 01 is Item, the 08 is Task, the final 01 is Workflow Task.

Again, I want to apologize for the call dropping during the question and answer portion of the talk.

2 replies
  1. Trent
    Trent says:

    Rregarding the following question:

    The answer provided is not correct. Clicking the “Terminate Workflow Now” link does NOT invoke the workflows cancel or fault handlers. I would love to know how to REALLY handle this event.

  2. Robert Bogue
    Robert Bogue says:

    I was pretty sure that one of the two events fired — are you running the Infrastructure Updates? There are a ton of fixes. However, another way is to replace the workflow status page and do your own processing.

Comments are closed.