Using InfoPath E-mail Forms to Communicate with External Users - Mel Balsamo
in

InfoPath Dev

This Blog

Syndication

Mel Balsamo

Using InfoPath E-mail Forms to Communicate with External Users

Greg’s blog post provided brief guidelines on how to create form templates with different versions. One is a restricted version for public-use, i.e. for external users; the other is a version for private use. The private version may contain some additional controls that allow you to do more with your forms, such as submitting them to a SharePoint document library.

This technique gives us the power to use InfoPath forms to capture offline e-mailed data for centralized SharePoint upload. We can email forms back-and-forth, to and from external users (sometimes offline or disconnected), and at the same time, manage those forms in private locations such as a SharePoint site. We need to make sure that the form data in both the public and the private locations are in-sync.

This blog post details the steps to setup a sample email form template with two different versions: Public and Private.

Here’s a diagram of the scenario we’re trying to accomplish: 



1. You email the form template (XSN) file to an external user (Public version – Ver. 1).

2. External user (sometimes offline) opens the form template, fills it out and emails back to you.

3. You receive the form (XML) and open it with the higher version of the form template (Private version – Ver. 2).

Note that you may receive a warning message that the form template associated with the form has a higher version than the one stored on your computer. Clicking Yes will open the form with your latest version.

4. You submit the form to your SharePoint document library.

5. You open the form from SharePoint, edit it and email it back to the user.

6. User receives the form, accepts the changes, re-edits and re-emails back to you.

Note that the user may also receive a warning message about the form template version. Clicking Yes will allow user to open the latest form.

7. You receive the form and re-submit it to SharePoint.

Sounds interesting? Let’s get started…

REQUIREMENTS:

  • InfoPath 2007
  • Outlook 2007
  • SharePoint Library

PUBLIC VERSION

1. Add the following fields to your main Data Source  



• Make the EmailAddress field required, so we know where to send the form back.

2. Add a layout table in your template, and drag the myFields node onto your table as Controls in Layout Table. Expand your controls as necessary to make them fit in your table.

3. Double-click on your Date field to open its properties.

a. Under the Data tab, click Format. Select any format for the time such as: 



b. Click OK.

c. Back in the Data tab, click on the fx icon beside the Value field, and enter the now() function in the formula box. 

This will ensure that we’ll have a unique date value every time we fill out a form the first time. We will specify this unique value as the form filename in our SharePoint library later.

d. Click OK to close all the dialog boxes.

4. Allow the Comments field to display multi-line in the Comments field properties > Display tab, just so there’s more space for users to fill it out.

Your form template should look something similar to this:  



5. Add a Submit data connection.

a. Go to Tools > Data Connections, click Add.

b. In the Data Connection Wizard, select Submit data > As an email message.

c. Specify an email address where you want your external users to send the form to; i.e. <YourEmail>@<YourCompany.com>.

d. You can enter any value as the email subject or select an existing field in your form template. In this example, we will use our Name field as the Subject. 

e. Click Next.

f. Select the option Send the form data as an attachment.

g. For the attachment name, combine the Name and the Date values. Click on the fx button beside the Attachment Name field, and enter concat formula as seen in the following image, making sure that the underlined fields are from your main data source: 

h. Click OK (no need to attach the form template in the email), Next, then Finish to exit out of the wizard.

6. Add and configure a Submit button.

a. Add a button at the bottom of your table, and double-click to open its properties.

b. In the Button Properties window’s General tab, select Submit in the Action dropdown, and click Submit Options.

c. Check the box Allow users to submit this form > Email > Email Submit.

d. Click the Advanced button to expand the window, and select Close the form in the After submit dropdown: 

7. Make the form restricted for external users.

a. Go to Tools > Form Options > Security and Trust.

b. Uncheck the box for Automatically determine security level, and select Restricted: 

c. Click OK.

8. Save the form template as PublicEmailForm.xsn.

Here’s how our public email form template looks like: 

PRIVATE VERSION

Next, we will design our private form template. It will have the same fields, so we can just modify our public form template.

1. While the public template is opened in Design mode, go to File > Save As and save it as PrivateEmailForm.xsn (to make sure that we are not working on the public version).

2. Modify the Email Submit data connection.

a. Go to Tools > Data Connections and modify Email Submit.

b. Click on the fx button next to the To field and insert the EmailAddress field. This field will contain the external user’s email address (where we wish to send the form back to).

c. Click Next twice, and then Finish to save your changes.

3. Configure the SharePoint Submit data connection.

a. In the Data Connections wizard, click Add to add another data connection.

b. Select Submit data > Next > To a document library on a SharePoint site > Next.

For the purposes of this tutorial, we will submit to a SharePoint document library named EmailFormsLibrary. This library should not exist yet. We will create it later when we publish our private form template.

c. Enter the URL to your EmailFormsLibrary SharePoint library, i.e. http://<SharePointSite>/EmailFormsLibrary/

d. For the file name, click on the fx button and select Date from your main data source. Again, we are making sure that our form file name is unique each time we submit a form to our SharePoint Library the first time; thus selecting Date which uses the now() function.

e. Check the box that allows overwrite if file exists. 

f. Click Next, leave the name as SharePoint Library Submit, and then click Finish.

g. Exit out of the Data Connections wizard by clicking Close.

4. Configure the submit buttons.

Note that we now have two Submit data connections, and we therefore need to use two buttons: one that submits to our SharePoint library, and another to email the form back to the external user. We also need to submit using rules and specify which Submit data connection to use.

a. Double-click on the existing Submit button to open its properties.

b. In the Action dropdown, select Rules and Custom Code.

c. Label the button Submit to SharePoint and click on Rules.

d. In the Rules dialog, click Add.

e. Name your rule SharePoint Submit and click on Add Action. The action would be to submit using the SharePoint Library Submit data connection: 

f. Click OK three times to close the dialog boxes.

g. In the Controls task pane, select Button to add another button just beside the SharePoint Submit button, and double-click to open its properties.

h. Label it as Email External User and click Rules.

i. In the Rules dialog, click Add.

j. Name your rule Email External User and click on Add Action. The action would be to submit using the Email Submit data connection: 

k. Click OK three times to close the dialog boxes.

5. Since we’ve already configured our submit function to use rules instead of the built-in submit feature, we can now disable that. In Tools > Submit Options, uncheck the box that allows users to submit the form, and click OK.

6. Set the security mode.

Since this form template is a private version, meaning it is used internally by users in your network/domain, we can allow the form to access content from the domain in which it is located.

a. Go to Tools > Form Options > Security and Trust and select Domain (or Full Trust). 

b. Click OK.

Here’s how our private email form template looks like: 

7. Save your PrivateEmailForm.xsn form template and then close it.


MANIPULATING FORM VERSIONS

Here’s where it can get a bit complicated. We want to manipulate InfoPath to think that our Public and Private forms are one-and-the-same, when in fact, they are two different forms. To make this happen, first, we need to give these two form templates the same ID. This is considered as a “Class A” trick.

As mentioned in Greg’s blog post:

The ID is used to determine which template a form will be opened with. But this ID is dynamic. As the Name changes, so does the ID. And every time you do a Save As, the Name and ID are changed.

A. Let’s start with our public form template:

1. Open PublicEmailForm is InfoPath Design mode.

2. Go to File > Properties. Here you will find fields for the Name, ID, and Description. 

3. To make things simpler and easier to understand, let’s remove the date and time stamp in the template’s URN: 

4. Click OK then File > Save.

5. Since this template is what we will email our external users with, we need to save it with a different name.

a. Go to File > Save As and name it EmailForm.xsn.

b. In File > Properties, notice that the Name and ID changed. 

c. Once again, remove the date and timestamps in the URN to avoid confusion. 

d. Click OK.

e. Go to Tools > Form Options > Versioning. Notice that the Version number is something like 1.0.0.x, where x is a number that automatically increments as we make changes to our template. We can leave it this way for our public email template.

f. Click OK, then File > Save.

6. We’ve already saved the public version as EmailForm; close it, and then send it to an external user by attaching the form template in the Outlook message.


B. Next, our private form template:

1. Open PrivateEmailForm.xsn in InfoPath Design mode.

2. We need to make sure that our private template will have a higher version number than the public one.

a. Go to Tools > Form Options > Versioning.

b. Change the Version Number from 1.0.0.x to 1.0.1.x. This way, when we open the forms (XML) in our local machine, they will open with the higher template version, which is the private one. Click OK.

3. Go to File > Properties: 

4. Remove the date and time stamp in the template’s URN: 

5. Click OK then File > Save.

6. This time, we will overwrite our previous EmailForm.xsn with this private form template.

a. Go to File > Save As > EmailForm > Overwrite.

b. In File > Properties, the Name and the ID once again becomes: 

c. Remove the date and time stamps, click OK then Save.

Notice that this template (private version) has the same ID as the one that we sent to our external user (public version). Don’t be confused, this template has a higher version number than the one already sent. As we know, forms will open with the higher version template.


C. Publish the private version to a SharePoint library

1. In EmailForm.xsn’s (previously PrivateEmailForm) File menu, click Publish.

2. Select to publish to a SharePoint server with or without InfoPath Forms Services, and click Next.

3. Enter the URL to your SharePoint site and click Next.

4. Select to create a Document Library > Next.

5. Select Create a new document library > Next.

6. Enter a name for your document library (remember that we wish to submit our forms to a library called EmailFormsLibrary). Click Next.

7. Promote some or all of the fields in your form as columns: 

8. Click Next, then Publish, then Close.

9. Close InfoPath.


SEE IT IN ACTION

1. Have an external user fill out and submit the public template you initially emailed.

2. You will receive the form (XML) in your email. 

3. In Outlook, click Open Form. It will open with the private version of the template. 

4. Make some changes in the form, such as editing the Comments, and click the SharePoint Submit button. 

5. Close the form in Outlook. If you get a warning asking you if you wish to save the form, select No.

6. Verify that the form is submitted to your SharePoint document library. 

7. Open the form from SharePoint, make some changes, and email it back to the external user by clicking the Email External User button. 

8. The external user will receive the modified XML and may receive a warning that the form template associated with the form contains a higher version. Clicking No will allow the user to open the form in Outlook using the public version.

9. The external user then modifies the form and emails it back to you by clicking the Submit button. Once again, if you open the received XML in Outlook, it will open with the private version:

10. Re-submit the form to your SharePoint library to make sure you are keeping the latest XML version. It will overwrite the existing XML in your SharePoint library: 

At this point, we should have three form templates in our machine: PublicEmailForm, PrivateEmailForm, and EmailForm. We are only concerned about EmailForm, as this form template contains the unique Name and ID that we wish to send back-and-forth, to and from our external users, and manage our SharePoint library forms with.

The PublicEmailForm and the PrivateEmailForm are just temporary placeholders. For instance, if you wish to send a public version to another external user, we can’t send them the latest EmailForm that we have (since it’s supposed to be the private version). To do this, we need to open PublicEmailForm in InfoPath Design mode, and re-save (overwrite) it as EmailForm. After sending to the external user/s, open PrivateEmailForm in Design mode and re-save (overwrite) it as EmailForm, and then re-publish to the same SharePoint document library.

You’ll realize that we’re just manipulating the same form template in terms of which version will be sent to public, and which version should open in our machine.

Once you get the hang of this, it will be easy for you to manage your form data and keep them in-sync no matter where you publish your forms.

Comments

 

Tena Matta » Blog Archive » InfoPath Resource Links » Tena Matta said:

Pingback from  Tena Matta  &raquo; Blog Archive   &raquo; InfoPath Resource Links &raquo; Tena Matta

September 29, 2011 11:34 AM
 

Sharepoint Install 2013 | Pearltrees said:

Pingback from  Sharepoint Install 2013 | Pearltrees

June 3, 2014 7:21 AM
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.