- Create Auto-numbering InfoPath form
- Publish InfoPath form to SharePoint Library as Content Type
- Creating Custom Workflows for Office SharePoint 2007
Create Auto-numbering InfoPath form
You can accomplish this functionality as follows:
1. In SharePoint, create a form library to submit your forms to.
2. In InfoPath, create a new (browser-compatible) InfoPath form template.
3. Add a Text Box control to the form template and name it autonumber.
4. On the Tools menu, click Data Connections.
5. On the Data Connections dialog box, click Add, and create a Receive data connection to the SharePoint library that you created in step 1. In step 5 of the data connection wizard, uncheck all fields and then check the ID field. In the last step of the data connection wizard, uncheck Automatically retrieve data when form is opened, name the data connection RetrieveIDs, and click Finish.
6. On the Data Connections dialog box, click Add, and create a Submit data connection to the SharePoint library that you created in step 1. In step 3 of the data connection wizard, click the formula button behind the File name field.
7. On the Insert Formula dialog box, type max( and then click Insert Field or Group.
8. On the Select a Field or Group dialog box, select RetrieveIDs from the Data source drop-down list box, expand all the nodes, click ID, and then click OK.
9. On the Insert Formula dialog box, type ) + 1 and click OK.
10. On the Data Connection Wizard dialog box, the expression in the File name field should resemble: max(@ID) + 1
11. On the Data Connection Wizard dialog box, click Next, name the data connection Main submit, and then click Finish.
12. On the Data Connections dialog box, click Close.
13. On the Tools menu, click Submit Options.
14. On the Submit Options dialog box, check the Allow users to submit this form checkbox, select the Perform custom actions using rules option, click Advanced, select Close the form from the After submit drop-down list box, and then click Rules.
15. On the Rules dialog box, click Add.
16. On the Rule dialog box, add an Action that says: Query using data connection: RetrieveIDs
17. On the Rule dialog box, add a second Action that says: Set a field's value: autonumber = max(@ID) + 1 Note: @ID is selected from the RetrieveIDs secondary data source in the same way you selected it in step 8.
18. On the Rule dialog box, add a third Action that says: Submit using data connection: Main submit
19. Click OK when closing all dialog boxes that are currently open.
20. Publish the form template to the library you created in step 1.You should now be able to fill out a form and submit it. The next available number in the form library will be automatically saved in the autonumber field of the form when the form is submitted and this number will also be used for the Name of the form. This solution works for both forms that are filled out through the InfoPath client application as well as those that are filled out through the browser.
Publish InfoPath form to SharePoint Library as Content Type
1- From the file menu, select Publish, you will be prompted to save the form template locally if you have not done so. You are required to do this to be able to publish the form template to SharePoint.
2- Select "To a SharePoint server With or Without InfoPath Form Services" when asked where to publish the form template.
3- Enter the URL of your SharePoint Server, Example "http://SharePointServer/"
4- Select the publish method: "Site Content Type"
5- Select "Create a new Content Type"
6- Enter a name for the content type
7- When asked to specify a location for the form template, enter the URL of the library created in the first step, press Next.
8- Press "Add..", and select the " autonumber " field from the list
9- Repeat for the second field
10- Press "Next"
11- Press "Ok" to close
Now Add and Set the Content Type as the Form Library's Default
1- Using the browser, navigate to the SharePoint Form library created in the second step.
2- From the "Settings" dropdown menu for the library, select "Forms Library Settings"
3- Under the General Setting heading, click "Advanced Settings"
4- Select "Yes" to Allow management of content types
5- Press OK
6- Under the Content Types section of the Library Settings page, select "Add from existing site content types"
7- Add the newly created content type from the form library, press OK
8- You can either remove the default "Document" content type from the library or set the new content type as the default to allow a blank form to be opened in a browser or InfoPath when the "New" button is pressed on the form library.
When a new form is submitted, it will be submitted to the specified SharePoint form library, with data from the fields in the InfoPath form being mapped to Columns in the library.
Creating Custom Workflows for Office SharePoint Server 2007
One of the most common human workflow scenarios is related to content approval. Below figure shows a flowchart describing an approval and routing business process. This scenario can be represented by a custom workflow. Before we walk through creating the workflow, we'll discuss the overall process.
Content Approval Workflow Scenario
The approval process is initiated when a user or author creates a new document and saves the document to a SharePoint document library (or uploads a new document). Individuals responsible for approving the content are notified by e-mail that there is new content pending approval, and confirmation is also sent automatically to the author. At this point in the process, a delay is introduced into the workflow due to the time it takes for an approver to review the material and decide whether to accept or reject. The approver downloads and reviews the content. After review, the content is either accepted or rejected. Based on the reviewer's response, the workflow can follow two different parallel paths:
• If approved, then the document is moved from its current location to a different document library for published content. An e-mail is sent to the author and approvers notifying them that the document has been approved.
• If the content is rejected, then the document is moved to another document library and the author and approvers are notified electronically.
Regardless of the path, the workflow terminates once notification has completed.
Creating the Content Approval Workflow
The following is a step-by-step walkthrough for creating a custom workflow that models the business process outlined in above Figure.
This walkthrough introduces you to the concept of creating a custom workflow using SharePoint Designer. You are encouraged to walk through this exercise on your own:
1. Create two new document libraries and name them Published, and Rejected. For the Submitted document library we created it before and add the InfoPath form to it, enable "Require content approval for submitted items" (from the Versioning Settings page).
2. Open SharePoint Designer. Close any site that may be open using the File ➪ Close Site command.
3. Open your Developers Team Site by choosing File ➪ Open Site. Inside of the Open Site dialog, enter the URL of your team site for the Site Name and click Open.
4. Open the Workflow Designer dialog by selecting File ➪ New ➪ Workflow. Assign the name Publishing to the workflow. Attach the workflow to the Submitted list. Enable "Automatically start this workflow when a new item is created" and disable all other start options. The result, with the Workflow Designer dialog showing the initial configuration for the Publishing workflow, Click Next.
5. Assign the name Launch and Wait to the Step Name.
6. From Conditions, select Compare Submitted Field. Assign Field to Approval Status and Value to Pending. From the Actions menu, choose Send an email. Click this message hyperlink to open the Define Email Message dialog. Click the address book icon at the end of the To: line to open the Select Users dialog. Select the Approvers group and add it to Selected Users. Add the user who created the current item to the CC: line using a similar process. Fill out the e-mail appropriately or leave it blank and then click OK.
7. From Actions, select More Actions and then select "Wait for field change in current item" and click Add. Assign Field to Approval Status. Change the "to equal" phrase to "not equal" and assign Value to Pending. This completes the Launch and Wait step.
8. Under Workflow Steps, click the Add Workflow Step hyperlink. Assign the name Review and Routing for step 2.
9. From the Conditions option, choose Compare Submitted Field. Click the Field hyperlink and select Approval Status. Click the Value hyperlink and select Approved.
10. From Actions, select Copy list item. Click the "first this list" hyperlink and select Current Item. Click the "second this list" hyperlink and choose Published.
11. From Actions, select Delete Item. You may need to choose More Items in order to see this option. Click the "this list" hyperlink, select "current item," and click OK.
12. From Actions, select Send an email. Click the "this message" hyperlink and fill out the e-mail. Send an e-mail to the user who created the current item and CC: the Approvers group.
13. Click the Add 'Else If' Conditional Branch hyperlink.
14. Add the Compare Submitted Field condition for the second condition. Assign Field to Approval Status, and Value to Rejected.
15. From Actions, select Copy list item. Assign the first "this list" to Current Item and the second to Rejected.
16. Add an action to delete the current item.
17. Add an action to Send an e-mail to the item creator stating that their document has been rejected and CC: the Approvers group. This completes the Review and Routing step.
18. Click Finish. As described previously, workflows authored using SharePoint Designer are automatically deployed and bound to the specific list during creation. The dialog will confirm that the Publishing workflow has been deployed and associated with the Submitted document library and that no instances have been created.
If you are going to utilize the e-mail capability from SharePoint Designer workflow, make sure that you have configured an e-mail server as part of your SharePoint deployment. If not, the workflow may have problems and not function as intended.
19. Navigate to the Submitted documents library. Create a new document and save it with the name First Document to the Submitted document library. Add some example text if you wish, such as this is a test of a new workflow. Close Word.
20. View the newly created document item in the Submitted library. Notice that the Approval Status of First Document is pending because you enabled content approval (back in step 2). Also notice that the Publishing column contains In Progress, indicating that an instance of the Publishing workflow has been created. Navigate to the Workflow Settings page of the Submitted document library to confirm that one instance has been created and is currently running.
21. Approve First Document by hovering the mouse over the item inside of the Submitted document library, clicking the drop-down arrow to reveal the context menu, choosing Approve/Reject, and then approving the content in the subsequent pages.
22. Once the document has been approved, confirm that the document is moved to the Published document library.
23. Repeat the process with a second document but this time reject the content to demonstrate that the created document is moved to the Rejected document library.
24. As an exercise, view the e-mails sent to the author after the document is submitted and approved or rejected. In addition, you can add users to the Approvers group and review the corresponding e-mail communication.

No comments:
Post a Comment