Sunday, November 30, 2008

Workflows: Starting a workflow from a survey response

A. Problem Description I have encountered several questions on the MSDN forums which try to troubleshoot problems of running workflows on survey responses. The problem they describe is the following: - Whenever you add a new response to a survey, the attached workflow does not start. - Instead, the status of the workflow appears as Failed to Start. B. Feedback Well, starting a workflow from a survey response is not supported in Windows SharePoint Services 3.0. Although the Workflows option appears when you click the arrow next to a survey response, you cannot start a workflow from a survey response. Microsoft has confirmed that this is a problem in the following Microsoft products: - Microsoft Office SharePoint Server 2007 - Microsoft Windows SharePoint Services 3.0 - Microsoft Office SharePoint Online Click here, for more details about this problem. C. Further Information Check this blog article, for more information about this issue.

Thursday, November 27, 2008

SPD Workflow: How to send a reminder a few days before the start date of a calendar entry?

A. Introduction As the title conveys, in this article I would like to show how one can create a workflow (using SharePoint Designer), which sends notifications to a list of recipients 7 days before the start date of a calendar entry. B. Preparations Create a Calendar, which we would attach the workflow to. For this demo, I have created a Calendar called Team Meetings. C. Workflow - Open Microsoft Office SharePoint Designer 2007. - Click File > Open Site. - Enter the URL of the site containing our calendar called Team Meetings. - Now click File > New > Workflow. - On the Define your new workflow page, enter the following data: --- Name: ReminderForMeetings --- Attachment List: Team Meetings --- Start Options: Automatically start this workflow when a new item is created and Automatically start this workflow whenever an item is changed - Click Next, in order to start designing the workflow steps. - Enter Calculate the reminder date as the Step Name. - In the Actions section, select the action Add Time to Date. - Click the 0 link and type -7. - Click the minutes link and select days. - Click the date link and then click fx. For the source select Current Item and for the field select Start Time. - Click OK. - Click the output link and create a new variable called ReminderDate of type Date/Time. - Click OK. - Click Add workflow step in the right panel, in order to create another workflow step. - Enter Check whether a pause is needed as the Step Name. - In the Conditions section, select Compare any data source. - Click the value link, then click fx. For the source select Workflow Data and for the field select ReminderDate. - Click the equals link and select is greater than. - Click the value link. Click the ellipsis, select Current Date and click OK. - In the Actions section, select the action Pause Unit Date. - Click the this time link and click fx. For the source select Workflow Data and for the field select ReminderDate. - Click Add workflow step in the right panel, in order to create another workflow step. - Enter Send reminder as the Step Name. - In the Actions section, select the action Send an Email. - Click the this message link and configure the different e-mail settings. - Click Finish, in order to save and publish the workflow. D. Test the solution 1. Create a new calendar item, whose Start Date is less than 7 days. -- Check that the ReminderForMeetings workflow has completed successfully. -- Check that you receive a notification now. 2. Create a new calendar item, whose Start Date is greater than 7 days. -- Check that the ReminderForMeetings workflow has started successfully. -- Check that you receive a notification on the right date.

Tuesday, November 25, 2008

Workflows: Comparison of SharePoint Designer and Visual Studio for creating workflow solutions

SharePoint Designer and Visual Studio 2005 (or later) can be used to create workflow solutions for MOSS. In order to be able to choose which platform to use, one has to understand the differences between authoring workflows in SPD versus Visual Studio. In the following section, I have summed up all the comparison criteria, which I have read in different books/articles or ones that I have tried myself. 1. Authors: SPD: Designers can author solutions, not just developers. VS: Only developers can author solutions. 2. Types of Workflows: SPD: It is possible to author sequential workflows only. VS: It is possible to author state-machine as well as sequential workflows. 3. Site Content Types: SPD: Does not support site content types. VS: Site content types are supported. 4. Deployment: SPD: Workflows are attached to a single list and are data-bound to that list. VS: Workflows are authored as templates. Such a workflow can be packaged as a SharePoint feature and installed on multiple sites or lists. 5. Forms: SPD: ASP.NET forms are auto-generated and can be customized. VS: Designed forms (InfoPath or ASP.NET forms) 6. Extendibility: SPD: Reuse out-of-the-box or custom deployed activities. No code-behind, so tools are limited to what’s included. VS: Reuse out-of-the-box activities, as well as building your own activities Code-behind capabilities make it very flexible and powerful. 7. Debugging: SPD: No step-by-step debugging. VS: Step-by-step debugging is supported.

Friday, November 21, 2008

Custom Workflow Actions: Links to SPD custom workflow activities

Introduction This article acts as an indexer for referencing pages which describe how to develop, troubleshoot and deploy custom activity libraries to be used in SharePoint Designer. They also contain links to alreday existing custom activities provided by open source communities. Links Useful Sharepoint Designer Custom Workflow Activities This codeplex project takes aim at making it easier to create advanced workflows using Sharepoint Designer by providing a set of custom workflow activities. http://www.codeplex.com/SPDActivities Workflow Essentials The SharePoint Solutions team has released a beta version of Workflow Essentials, which provides you with a proven reliable, less expensive way to augment SharePoint Designer's workflow capabilities. Workflow Essentials is a suite of useful custom activities and conditions for the SharePoint Designer. It is compatible with both WSS v3.0 and MOSS 2007. But it is NOT FREE. Workflow Essentials pricing information will be forthcoming in the near future. http://sharepointsolutions.blogspot.com/2008/11/announcing-workflow-essentials-for.html User Profile Sharepoint Designer Activities 0.2.0 The "User Profile related SharePoint Designer Activities" is a solution package (.WSP file) that contains four SPD actions (workflow activities) for the SharePoint Designer workflows. This package is only for MOSS 2007 installations. It will not work on WSS 3.0 machines. The available actions are: (1)Get user title, (2)Find manager of the user, (3)Find display name of the user and (4)Find department of the user. http://edinkapic.blogspot.com/2008/05/user-profile-sharepoint-designer.html Adding Activities to SPD This article answers one of the most frequently asked questions: adding activities into the SPD workflow designer. It gives a quick summary, shows you an example and provides some tips and tricks to help solve common issues. http://blogs.msdn.com/sharepointdesigner/archive/2007/03/15/adding-activities-to-spd.aspx Multi Value Columns Solution #2 - Custom Activities in SPD The default Send an Email activity in SharePoint Designer can’t send e-mails to multiple recipients if those recipients exist inside of a multi-value column in a SharePoint list. This article describes a custom workflow activity that overcomes this issue. http://rapidapplicationdevelopment.blogspot.com/2007/04/multi-value-columns-solution-2-custom.html HOW TO: Create a custom Windows Workflow Activity and make it available in SharePoint Designer The default Send an Email activity in SharePoint Designer doesn't allow you to specify a from email address. This article describes a custom workflow activity that overcomes this issue. http://www.sharepointblogs.com/tbaginski/archive/2007/03/08/how-to-create-a-custom-windows-workflow-activity-and-make-it-available-in-sharepoint-designer.aspx Sending an email to a group with a SharePoint workflow Dave has encountered a problem when trying to send notifications to user groups using the default SPD Send an Email activity. This has led him to develop a custom activity. He finally has blogged about it in this article. http://davesquared.blogspot.com/2007/07/sending-email-to-group-with-sharepoint.html But Mark Deraeve left a comment about a much better solution for Dave's problem. It turned out that it is all about some missing group permissions. Check it here. http://www.dailycode.net/blog/post/Send-email-to-user-group-in-Sharepoint-Workflow.aspx Create Sharepoint Site By Template in Code - Workflow Custom Activity This post documents the steps for building a custom activity that creates a Sharepoint site by template. This post also talks about the steps needed in order to add this custom activity into the Sharepoint designer. http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/07/08/SharepointSiteByTemplate.aspx SPD Workflow activity : Copying a listItem accros a site This custom workflow activity for Sharepoint Designer can copy a list item accros a site and/or to a list that is not available during the creation of the workflow but will be when the workflow is executed (using workflow variables). http://glorix.blogspot.com/2007/03/spd-workflow-activity-copying-listitem.html SPD Workflow activity : Creating a document library This article describes a custom activity that creates a document library using two variables that a user should enter in SPD. These two variables are the url of the site and the title of the document library. http://glorix.blogspot.com/2007/03/spd-workflow-activity-creating-document.html Sharepoint Workflow Custom Activity for Active Directory & Deployment on Moss 2007 This article illustartes how to create your own custom workflow activities using Windows Workflow Foundation. http://www.c-sharpcorner.com/UploadFile/rifaqats/rifaqat01102008014938AM/rifaqat.aspx

SPD Workflow: Real-life business workflows developed with SharePoint Designer

Introduction This article acts as an indexer for referencing pages that provide step-by-step descriptions for developing SPD workflows that solve real-life business problems. Articles Use SharePoint Designer to Email Daily Task Reminders Companies often turn to some kind of automated reminder system to prod End Users into marking their tasks complete, thereby allowing those beautifuly orchestrated business processes to proceed as designed. This article describes how “Power” End Users and Developers alike can use SharePoint Designer to create an automated task reminder system based on SharePoint’s core workflow capability. http://sharepointmagazine.net/technical/development/the-dog-ate-my-task-use-sharepoint-designer-to-email-daily-task-reminders Task Escalation using Workflows Organizations sometimes need to have a system that automatically escalates overdue tasks to other people. This article illustrates how to achieve this business target using a SharePoint Designer workflow. http://sharepointsolutions.blogspot.com/2008/10/task-escalation-using-workflows.html Looping Through Items in a SharePoint List with SharePoint Designer Workflows One of the things that most frustrates developers about SharePoint Designer workflows is that there is no convenient way to write loops. Not only can we not create For…Next, For…Each, Do…While, and Do…Until loops within our workflows, but there is no obvious way to loop through items in a list. This article removes that last barrier! http://sharepointsolutions.blogspot.com/2008/05/looping-through-items-in-sharepoint.html Useful SPD workflows A collection of my articles that answer common SPD workflow questions posted on the MSDN forums. http://samar-hossam-sharepoint-spot.blogspot.com/search/label/Workflows%20-%20Useful%20SPD%20workflows

Tuesday, November 11, 2008

MOSS Configuration: How to set a document library column to READ-ONLY

A. Background In this article I describe how to configure the following requirements: - A list contains a custom column which should be filled by a workflow only. - This column should be read-only, i.e. it should neither appear on the New form nor on the Edit form. B. List preparations: 1- Create a custom list called Student Marks. 2- Create the following columns: - Student Name of type Single line of text - English of type Number - Math of type Number - Total of type Number Now the New form looks like this: 3- Hide the Total field from the New and Edit form. - Click Settings > List Settings > Advanced Settings. - Set Allow management of content types? to Yes. - Click OK to get back to the Settings page. - Under the Content Types section, click Item. - Under the Columns section, click the Total column. - In the Column Settings, select Hidden. - Click OK. - NOTE: If you have more than one content type defined on this custom list, then you have to repeat these steps for every Content Type. Now the New form looks like this: C. Workflow in SharePoint Designer: 1- Open Microsoft Office SharePoint Designer 2007. 2- Click File > Open Site. 3- Enter the URL of the site containing our custom list called Price List. 4- Now click File > New > Workflow. 5- On the Define your new workflow page, enter the following data:
  • Name: Calculate Total
  • Attachment List: Student Marks
  • Start Options: Automatically start this workflow when a new item is created
- Click Next, in order to start designing the workflow steps. - Enter Calculate the total as the Step Name. - In the Actions section, select the action Do Calculation. - Click the value link then click fx. For the source select Current Item and for the field select English. - Leave the operator as plus. - Click the other value link then click fx. For the source select Current Item and for the field select Math. - Click the output variable link. Then Create a new variable called calculatedTotal. - In the Actions section, select the action Set field in Current Item. - Click the field link and select Total. - Click the value link then click fx. For the source select Workflow Data and for the field select calculatedTotal. - Click Finish, in order to save and publish the workflow. D. Test the solution 1. Create a new item in the Students Marks list. 2. Check that the workflow has completed successfully. 3. Check that the Total field contains the correct sum.

Monday, November 3, 2008

SPD Workflow: Was the workflow started due to a Create or an Edit action?

A. Introduction When creating a workflow using Office SharePoint Designer, you might choose to start the workflow when a new item is created OR whenever an item is changed. Consider the case that the actions performed in both situations are the same except for one step which should differ based on whether the processed item is a new one or just an updated one. A simple straight-forward solution is to create two workflows that differ only by one step. I don't need to elaborate on how inconvenient this approach is: (1) during the development phase (2) whenever you need to maintain the workflows. As the title conveys, in this article I would like to show how one can use the Conditions section to determine whether the workflow was triggered due to an item's change or a new item's creation. This way, you would need only one workflow which would branch whenever needed and merge back. B. Preparations Create the list, which we would attach the workflow to. For this demo, I have created a custom list called Price List. C. Workflow - Open Microsoft Office SharePoint Designer 2007. - Click File > Open Site. - Enter the URL of the site containing our custom list called Price List. - Now click File > New > Workflow. - On the Define your new workflow page, enter the following data:
  • Name: CreateOrEdit
  • Attachment List: Price List
  • Start Options: Automatically start this workflow when a new item is created and Automatically start this workflow whenever an item is changed
- Click Next, in order to start designing the workflow steps. - Enter Check whether the item is new or updated as the Step Name. - In the Conditions section, select Compare Price List field. - Click the field link and select Created. - Leave the operator as equals. - Click the value link then click fx. For the source select Current Item and for the field select Modified. - Click OK. - In the Actions section, select the action Log to History List. - Click the this message link and type the text: This is a new item. - Click the Add 'Else If' Conditional Branch. - In the Else branch add the action Log to History list. - Click the this message link and type the text: This is an updated item. - Click Finish, in order to save and publish the workflow. D. Test the solution 1. Create a new item. -- Check that the CreateOrEdit workflow has completed successfully. -- Check that the History Log displays the comment: This is a new item. 2. Edit the created item. -- Check that the CreateOrEdit workflow has completed successfully. -- Check that the History Log displays the comment: This is an updated item.

Sunday, November 2, 2008

Custom Workflow Actions: Structure of the .ACTIONS file

When you create a custom workflow activity, you need to create a so-called .ACTIONS file. But a very common questions to beginners is What is the schema of that XML file? In this article I would provide an overview of the .ACTIONS file's structure and some useful documentation links. A. Structure of the .ACTIONS file The following sketch displays the elements contained in the Workflow Actions Schema. Each node links to the corresponding element's documentation page on MSDN. WorkflowInfo Element | |__Conditions Element |.....| |.....|__Default Element |.....| |.....|__Condition Element | |__Actions Element ......| ......|__Default Element ......| ......|__Action Element ............| ............|__RuleDesigner Element ............|.....| ............|.....|__FieldBind Element ............|.....| ............|.....|__Option Element ............| ............|__Parameters Element ............ .....| ............ .....|__Parameter Element B. Useful Links Workflow Actions Schema Overview http://msdn.microsoft.com/en-us/library/bb897626.aspx .ACTIONS File Example http://msdn.microsoft.com/en-us/library/bb897811.aspx Actions Schema Reference http://msdn.microsoft.com/en-us/library/bb897833.aspx Out-of-the box Workflow Actions http://msdn.microsoft.com/en-us/library/bb897644.aspx Out-of-the box Workflow Conditions http://msdn.microsoft.com/en-us/library/bb897890.aspx