Side-by Side versioning with Content Types - Jo-Anne Alfafara
in

InfoPath Dev

Jo-Anne Alfafara

Side-by Side versioning with Content Types

Scenario

Do you have InfoPath forms created in different versions? Want to have old forms shown in old form template and new forms in new form template? No problem!!! Follow this document and you will be able to create side-by-side versioning of InfoPath form using Content Types.

If you want to use DBXL to map these content types to your SharePoint library, see this previous blog post.

Design the form (Version 1)

1. Open a blank form in design mode.

2. Create the following fields in the form. Notice that “Issue” group is a repeating section.

3. Drag and drop the fields into the form. Now we are done with creating the form template. Your form will look like this:

4. Save the form template locally as CustomerContact-v1.xsn. Let’s consider this as version 1 form.

Design the form (Version 2)

1. Create the next version (version 2) of the form and name it CustomerContact-v2.xsn.

2. Change a bit of the schema by adding a new field called “Company” under “CustomerInfo” and make it a required field. Add another new field “DateTime” (of datatype Date) under “Issue” and enter today() as the default value for the field.

3. Clear the previous display, and drag & drop the new schema into the form.

4. Change the control of the DateTime field to textbox, and change the display of the field to Read-only.

5. Go to form template properties and make sure the name of the form template is “CustomerContact-v2”. Save your changes to the form.

Publish the Form Templates as Content Types

1. Create a Form Library that will hold the content types (i.e. http://dbxl-vm/MyContentTypes/Forms/AllItems.aspx).

2. Open the first form template (CustomerContact-v1.xsn) in design mode.

3. Select File > Publish.

4. In the Publishing Wizard, enter the SharePoint server root where you want to publish the form template. Click Next.

5. The key thing here is to choose Site Content Type, click Next.

6. Select Create a new Content Type and click Next.

7. In the next window, enter a name for your content type (CustomerContact-v1). Click Next.

8. Specify a location and file name for the form template (e.g. http://dbxl-vm/MyContentTypes/Forms/CustomerContact-v1.xsn), and then click Next.

9. When asked to choose the columns you want to display in the SharePoint library, add the fields and click Next.

10. Click Publish. When done, click Close. Your form template will be published as content type.

11. Repeat steps 1-10 to publish CustomerContact-v2.xsn to the same content type library.

Create a new Form Library and add the Content Types

1. Create a new form library.

2. Go to your SharePoint Form Library -> Settings -> Form Library Settings -> Advanced Settings.

3. Select Yes to allow management of content types, and click OK.

4. Back in the Form Library Settings, select Add from existing site content types under Content Types section.

5. In the Add Content Types page, select the two content types that were published in the SharePoint site (CustomerContact-v1 and CustomerContact-v2) and click Add. Click OK.

6. Back in the Form Library Settings, select Change new button order and default content type under the Content Types section.

7. Choose CustomerContact-v1 as Position 1, which makes it the default content type, and CustomerContact-v2 as Position 2. Then uncheck the visible check box for “Form”. Click OK.

Create two versions of the form

1. In the form library, click the down arrow for New Document. You can see that we can choose the templates from both versions.

2. Select CustomerContact-v1.

3. Fill out the Customer Contact form and save it as “Version1Form”. Close the form.

4. Now, select CustomerContact-v2 under the New Document.

5. Fill out the Customer Contact form and save it as “Version2Form”.

6. Now we have two versions of the InfoPath forms both using their own templates to save information.

Comments

 

Gennady Vanin (Геннадий Ванин, Новосибирск) said:

Awesome...

The most useful and clear tutorial on Infopath I'му ever encountered

Though, some comment, for the sake of absolute purity:

"Add another new field “DateTime” (of datatype Date) under “Issue” and enter today() as the default value for the field" is not possible

Adding of functions, like today() for default values of a field, is  accepted only after drag&dropping on design surface the Date Picker control from this field.

Otherwise, Infopath gives an error:

"The value is not valid for the field's data type. Enter a different value (example: "31.12.2000") or leave the box blank. OK"

July 14, 2012 10:14 AM
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.