by S.Y.M. Wong-A-Ton
This article describes how you can create a SharePoint Designer workflow that is run whenever a new InfoPath web-based form is submitted to a SharePoint form library and sends an email, which contains a link to open the InfoPath form in the browser.
Problem
You want to be able to send an email to one or more users when an InfoPath form is submitted to a SharePoint form library. You also want to include a link to the form that was submitted, so that users can click and open the form in a browser.
Solution
Create a custom SharePoint Designer workflow that sends out an email when an InfoPath web-based form is submitted to a SharePoint form library.
Discussion
You can achieve this functionality as follows:
1. In InfoPath, create a browser-compatible form template and publish it to a SharePoint form library.
2. In SharePoint, configure the form library to display InfoPath forms as a web page.
3. In SharePoint Designer, on the File menu, click Open Site, and open the SharePoint site where the form library resides.
4. On the File menu, select New, and then click Workflow.
5. On the Workflow Designer, type a name for your workflow, select the form library that contains your InfoPath forms as the SharePoint list to attach the workflow to, deselect Allow this workflow to be manually started from an item, select Automatically start this workflow when a new item is created, and click Next.
6. On the Workflow Designer, click Actions, and then select Send an Email from the context menu that appears. This will add the action
Email this message
to the actions for Step 1.
7. Click this message in the Email this message action.
8. On the Define E-mail Message dialog box, enter one or more valid email addresses in the To field, and enter a subject in the Subject field.
9. In SharePoint, go to the form library where your InfoPath forms are stored, and click an existing InfoPath form to open it in the browser.
10. Copy the URL of the InfoPath form. The URL could resemble the following:
http://ServerName/SiteName/_layouts/FormServer.aspx?XmlLocation=/SiteName/LibraryName/Form1.xml&Source=http%3A%2F%2FServerName%2FSiteName%2FLibraryName%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1
where ServerName is the name of the SharePoint server, SiteName is the name of the SharePoint site, LibraryName is the name of the SharePoint form library, and Form1.xml is the name of an InfoPath form.
11. In SharePoint Designer on the Define E-mail Message dialog box, paste the URL in the email's body field.
12. Highlight the URL for the InfoPath form that comes after the XmlLocation parameter,
/SiteName/LibraryName/Form1.xml
in this case, and click Add Lookup to Body.
13. On the Define Workflow Lookup dialog box, select Server Relative URL from the Field drop-down list box, and click OK. The final link should now resemble:
http://ServerName/SiteName/_layouts/FormServer.aspx?XmlLocation=[%LibraryName:Server Relative URL%]&Source=http%3A%2F%2FServerName%2FSiteName%2FLibraryName%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1
14. On the Define E-mail Message dialog box, click OK
15. On the Workflow Designer, click Finish.
Now whenever you create a new InfoPath form and save it to the form library, the SharePoint Designer workflow is started, and an email is sent to the recipients you specified for the email in the workflow. When a user opens the email and clicks on the link in the email, the InfoPath form opens in the browser.
REF: http://www.bizsupportonline.net/browserforms/create-sharepoint-designer-workflow-send-email-link-infopath-browser-form.htm
Thursday, January 14, 2010
Wednesday, January 13, 2010
Auto-numbering InfoPath forms when they are submitted to a SharePoint form library
by S.Y.M. Wong-A-Ton
Use rules, formulas, and the max() function to generate incremental numbers that can be assigned to InfoPath forms when they are submitted to a form library.
Problem
You want to automatically assign a number to an InfoPath form whenever it is submitted to a SharePoint form library.
Solution
Use rules, formulas, and the max() function to generate incremental numbers that can be assigned to InfoPath forms when they are submitted to a form library.
Caveat: When the form library is empty, i.e. when it contains no forms, the max() function will fail and the resulting number for the first form that is submitted to the form library will be NaN. The correct numbering for subsequent form submissions should succeed. As a workaround you can manually rename the first form to 1 in SharePoint.
Discussion
You can accomplish this functionality as follows:
Use rules, formulas, and the max() function to generate incremental numbers that can be assigned to InfoPath forms when they are submitted to a form library.
Problem
You want to automatically assign a number to an InfoPath form whenever it is submitted to a SharePoint form library.
Solution
Use rules, formulas, and the max() function to generate incremental numbers that can be assigned to InfoPath forms when they are submitted to a form library.
Caveat: When the form library is empty, i.e. when it contains no forms, the max() function will fail and the resulting number for the first form that is submitted to the form library will be NaN. The correct numbering for subsequent form submissions should succeed. As a workaround you can manually rename the first form to 1 in SharePoint.
Discussion
You can accomplish this functionality as follows:
- In SharePoint, create a form library to submit your forms to.
- In InfoPath, create a new (browser-compatible) InfoPath form template.
- Add a Text Box control to the form template and name it autonumber.
- On the Tools menu, click Data Connections.
- 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.
- 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.
- On the Insert Formula dialog box, type max( and then click Insert Field or Group.
- 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.
- On the Insert Formula dialog box, type ) + 1 and click OK.
- On the Data Connection Wizard dialog box, the expression in the File name field should resemble:
max(@ID) + 1 - On the Data Connection Wizard dialog box, click Next, name the data connection Main submit, and then click Finish.
- On the Data Connections dialog box, click Close.
- On the Tools menu, click Submit Options.
- 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.
- On the Rules dialog box, click Add.
- On the Rule dialog box, add an Action that says:
Query using data connection: RetrieveIDs - 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. - On the Rule dialog box, add a third Action that says: Submit using data connection: Main submit
- Click OK when closing all dialog boxes that are currently open.
- 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.
Subscribe to:
Posts (Atom)