Workflow Lite for SharePoint RC1 (Finally!)
Finally I've found some time to work some more on my SharePoint Lite for SharePoint project and today the Release Candidate 1 can be downloaded form the GotDotNet Workspace. RC1 is feature-complete for V1 (I've already got some cool features for the next version in mind), to get an idea what's possible you can watch this video. To install the workflow engine, execute the MSI package (so the assembly gets deployed to the GAC) and follow the installation instructions closely. The installation instructions are modified a little bit, so the installation video isn't up to date anymore but it will be updated ASAP. Probably the main part in the installation is the creation of the config file that contains the workflow logic. At this point you need to alter the configuration XML file manually, but there's a Configuration Application on its way. A very basic configuration file could look like this (updated on the 15th of June, see http://weblogs.asp.net/jan/archive/2004/06/15/156419.aspx):
<?xml version="1.0" encoding="utf-8" ?>
<WorkflowConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://Leadit.SharePoint.Workflow/WorkflowConfiguration">
<WorkflowStage DocumentLibraryURL="http://server/site/documentlibrary">
<Description>DocumentLibrary 1</Description>
<Properties>
<Property Name="Status">
<Triggers>
<Trigger PropertyValue="Ready To publish">
<Actions>
<Action Type="COPY">
<Parameter1>In Review</Parameter1>
<Parameter2></Parameter2>
<Parameter3></Parameter3>
</Action>
<Action Type="SETFIELDVALUE">
<Parameter1>Submitted by</Parameter1>
<Parameter2>{FIELD:Modified By}</Parameter2>
<Parameter3></Parameter3>
</Action>
<Action Type="DELETESOURCE">
<Parameter1></Parameter1>
<Parameter2></Parameter2>
<Parameter3></Parameter3>
</Action>
<Action Type="SENDMAIL">
<Parameter1>review@mycompany.com</Parameter1>
<Parameter2>Document {FIELD:Title} added for review</Parameter2>
<Parameter3>Submitted by{FIELD:Submitted by}{NEWLINE}Submitter comments:{NEWLINE}{FIELD:Comments}</Parameter3>
</Action>
</Actions>
</Trigger>
</Triggers>
</Property>
</Properties>
</WorkflowStage>
</WorkflowConfiguration>
A configuration file contains one or more WorkflowStage nodes, each node corresponds to a stage in the workflow process, so a SharePoint document library corresponds to a WorkflowStage. The DocumentLibraryURL tag sets the location of the document library for which it should work, the Description tag is descriptive only. A WorkflowStage node can contain one or more Property nodes, contained in the Properties tag. A Property node corresponds with a field of the document library which will be used by the workflow process. The Name attribute of the Property tag should contain the name of that document library field. Each Property node can contain one or more Trigger nodes, contained in the Triggers tag. A Trigger node corresponds with a specific value of the document library field, which should be specified in the PropertyValue attribute. Finally a Trigger node can contain one or more Action nodes, contained in the Actions tag. An Action node corresponds with an action that the workflow process should execute. Each Action node has a specific type, and three optional parameter values. Here’s a list of the Action types that are currently implemented:
- Action type: COPY
Copies the document library item to a specified document library. Any action that is executed before the copy statement is applicable to the originating document library item. Any action that is executed after the copy statement is applicable to the copied document library item. For example: a SETFIELDVALUE action that happens before the COPY action, changes a field value of the originating document library item. A SETFIELDVALUE action that happens after the COPY statement will change a field value of the copied document library item. Of course the DELETESOURCE is always applicable to the originating item!
Parameter 1: destination document library
Parameter 2 and 3: not used - Action type: SETFIELDVALUE
Sets the value of a field to a specified value. This value can be a fixed string, or a reference to other field values.
Parameter 1: name of the field to set
Parameter 2: value to which the field should be set (see formulas for more information about the format). Examples: “Fixed string“, “{FIELD:OtherField}“, “{FIELD:OtherField1} fixed string {FIELD:OtherField2}“
Parameter 3: not used - Action type: DELETESOURCE
Deletes the originating file from the document library.
Parameter 1, 2 and 3: not used - Action type: CREATEEVENTITEM
Creates an event item in a specified event log SharePoint list. The event log SharePoint list is a custom list, containing the following fields: Title (default), Event (single line of text), Initiator (user lookup field), Comments (multiple lines of text).
Parameter 1: the event log SharePoint list
Parameter 2: the event type (for example: “Document Published“, “Document Declined“)
Parameter 3: comments for the event log item (see formulas for more information about the format) - Action type: SENDEMAIL
Sends an email to a specified person or a specified SharePoint group.
Parameter 1: mail to value. This value can either be a fixed string like “reviewer@mycompany.com“, the name of a SharePoint Group (site level) or the value of a specific field like “{FIELD:Modified By}“. In the last case, the workflow engine will retrieve the corresponding email of the user specified in the Modified By field. The value of parameter 1 can contain HTML, so HTML formatted mails are sent.
Parameter 2: mail subject value (see formulas for more information about the format)
Parameter 3: mail body value (see formulas for more information about the format)
A parameter that can contain a formula, can use references to other fields of the document library item. The syntax is pretty straight forward, some examples:
- {FIELD:Submitter Comments}
- Comments by {FIELD:Modified By} {NEWLINE} {FIELD:Submitter Comments}
- Submitted by {FIELD:Modified By} on {NOW}
So what's next? In the next few days I will create more documentation and update the demo and installation video to reflect the new possibilities. Based on your feedback the final V1 version will be released. After that I'll be accepting contributors for the GotDotNet Workspace, if you're intrested contact me, and I'll invite you. Please do only apply if you are really planning to contribute to the project! Thanks to the people who have mailed me their feedback and bugs!