Step 1: We need to build out 3 Info Path forms: Initiation, Association, and Action forms
For the Association InfoPath form do the following:
- - Open InfoPath and click Design a Form Template
- - Select based on 'Blank' and click OK
- - Create a form name it Association.xsn
- - Go to the Design a Form Link on the right and goto 'DataSource'
- - Setup a name for your data source (FormFields)
- - Create some field names (User Name, Full Name, Review Type, Comments)
- - Goto Layout task and insert a custom table with 1 column and 3 row
- - Goto Controls task and uncheck 'Auto-create' datasource and then drag a textbox into the first two rows and a button in the last row
- - In the properties of the textboxes make sure their bindings match User Name and Full Name and then go into the button properties and create 2 actions
- - First action (Submit data using a data connection)
- - Add action ( click add, Create a new connection to: Submit Data, Next, To the hosting environment, Enter 'Submit', click finish.
- - Second action (Close this form: No Prompt)
Your form should look like this:
For the Initiation form follow these steps:
- - Open up Assocation.xsn again in design mode and save as... name it InitiationForm.xsn
- - Change the binding of the textbox to ReviewType and Comments
- - Save the form
Your form should look like this:
For the Action form follow these steps:
- - Follows the steps from the Association Form directions and create a new template called Action.xsn
- - Re-name the data source to actionFields and create these fields (reviewCompleted, reviewNotes)
- - Set its data-type to boolean (True/False) for reviewCompleted
- - Set reviewNotes to Text field (string)
- - Copy the same Rules that you did for the button in the first form. (Submit using a data connection, Close the form)
- - Save the form and exit
Step 2: Add Item Schema
- Create an xml file called itemdata.xml
- Copy this xml into the file and save
- <z:row xmlns:z="#RowsetSchema"
ows_managerUsername=""
ows_managerFullName=""
ows_reviewType=""
ows_Comment="" />
- Open up the Action.xsn form in design mode and goto Data Sources link
- Click Manage Data connections and go through the wizard and create a connection to receive data
- Select the XML document option and then browse to find the file, then on the next screen make sure the checkbox is checked concerning Auto-Retrieve data when form is opened, and use the default name, and click finish
- On the reviewNotes text box goto properties and set the formula (fx) to Insert Value or Group button and select ows_reviewComments node and click OK
- Save form and exit
Step 3: Create a workflow project (Sequential Workflow)
- - Open Visual Studio 2008 and create a new project called EmployeeReview based off the SharePoint Server Sequential Workflow template
- - http://collaborationnation.blogspot.com/2009/02/cannot-activate-office-sharepoint.html - follow these steps if you get the error about deploying to the sharePoint site collection, you need to use the stsadm.exe tool to activate the Publishing feature in sharepoint (pain-in-my-butt!)
- - Also, make sure your path for the debug location just includes the http://sitename:portNumber
Step 4: Publish the Info Path forms
- We have to publish the forms to the server so inside of InfoPath you need to located the AssociationForm.xsn (or whatever you called the Association form) and goto Design Tasks
- Click 'Change Compatibility Settings'
- Check the box 'Design a Form Template That Can Be Opened in a Browser'
- Enter the URL of the InfoPath forms service (assuming you already started it, e.g. http://server/)
- Click Security and Trust and then uncheck 'Automatically Determine Security Level'
- Click Full Trust mode
- Click Create a Certificate and then OK.
- Go back to Design Tasks list and make sure that the Design Checker does not have any issues/problems
- Click 'Publish Form Template' and click browse, (make sure your path is the same path as where the workflow project in visual studio resides) find your AssociationForm.xsn and select it and click OK.
- Clear the next screen for 'alternate path access' and click OK
- Click 'Publish'
- Once complete, repeat for both other forms (InitiationForm.xsn, Action.xsn) and make sure to use the same certificate you created , there is no need to have multiple certificates unless specified
- Click 'Change Compatibility Settings'
- Check the box 'Design a Form Template That Can Be Opened in a Browser'
- Enter the URL of the InfoPath forms service (assuming you already started it, e.g. http://server/)
- Click Security and Trust and then uncheck 'Automatically Determine Security Level'
- Click Full Trust mode
- Click Create a Certificate and then OK.
- Go back to Design Tasks list and make sure that the Design Checker does not have any issues/problems
- Click 'Publish Form Template' and click browse, (make sure your path is the same path as where the workflow project in visual studio resides) find your AssociationForm.xsn and select it and click OK.
- Clear the next screen for 'alternate path access' and click OK
- Click 'Publish'
- Once complete, repeat for both other forms (InitiationForm.xsn, Action.xsn) and make sure to use the same certificate you created , there is no need to have multiple certificates unless specified
Step 5: Coding the workflow
- On the workflow1.cs , right-click and 'generate event handlers'
- Check your toolbox and make sure you have the SharePoint Workflow templates installed (VS2008 should already have them, VS2005 you might need to install them or point to them thru > Choose Toolbox Items > Complete Task, etc)
This has been a pretty long blog post and if you want to see how to code the rest of the workflow see Building an Employee Review workflow in SharePoint 2007 - Part 2.
No comments:
Post a Comment