2015-01-02

In January, 2014 the announcement that Microsoft InfoPath 2013 is the last release of the desktop client sent shock waves around the SharePoint community. They stated that ‘…we’re retiring InfoPath and investing in new forms technology across SharePoint, Access, and Word. This means that InfoPath 2013 is the last release of the desktop client, and InfoPath Forms Services in SharePoint Server 2013 is the last release of InfoPath Forms Services.’

TIP: Find your next Infopath Forms Replacement over in our Collab365.Directory.

Microsoft hasn’t yet announced the successor to InfoPath. Therefore, InfoPath will not be going anywhere soon. Some of us are still working with InfoPath Forms and InfoPath Services.

The InfoPath 2013 client application will be supported until April 2023, as will Forms Services for SharePoint 2013. InfoPath Forms Services in Office 365 will be supported until further notice.

The Exercise:

In this exercise, a ‘Request Form’ and an ‘Employee Vacation Request’ Approval process workflow will be created and deployed to a SharePoint site. In Part 1 of this exercise, we will design the ‘Request Form’.  Part 2 will go into the SharePoint Workflow. The required tools are:

  • InfoPath 2010 or 2013 Designer
  • SharePoint 2010 or 2013 Enterprise environment
  • SharePoint 2010 or 2013 Designer

Steps:

On InfoPath Designer:

  • Create New SharePoint Form Library and set the target SharePoint Site
  • Create following objects on the Form:

 1.    Five Fields:

  • RequestNumber (String)
  • Justification (String) multiline, Mandatory
  • StartDate (Date), Mandatory
  • EndDate (Date), Mandatory

 2.    Two Buttons:

  • Submit
  • Cancel

3.    Three Views:

  • Default View (edit mode view & default view)
  • Read Only View (when the form submitted all the controls will be on read only mode)
  • Thanks View (after submission, a request rule will switch and show the request number)

This is the Default View (edit mode) as shown in the screenshot.

How to add new view? Ribbon menu >> Page Design >> New View.

Add new view with read only mode. Name it ‘ReadOnly’ or something similar. Remove the default table and copy the table and content form default view. Now after copying the table to read only view set the read only property from the view properties.

Check ‘Read only’ option then click on ‘OK’.

The read only view removes all the buttons, add new to close the form and set rule to close the form.

So, the final view of read only will be like below screenshot:

Now repeat same steps to create ‘Thank You View’.

This view will contains only one calculated control of ‘Request Number’ as request reference to inform the user about his or her request.

  • Add calculated control
  • Insert from the formula from field ‘RequestNumber’
  • Move the control after the text ‘Your request ….’

Publish the Form to SharePoint Server as a Form using the publishing wizard.

Add target SharePoint Site URL.

Create new Form Library.

Name it ‘Vacation Request’.

Expose the fields to SharePoint.

By adding following fields as columns on SharePoint Form Library.

  • ‘Request Number’
  • ‘Start Date’
  • ‘End Date’
  • ‘Justification’

The SharePoint Designer Workflow steps will be explained later on.

To create the connections and rules, Click ‘Data Connections’ button on the Data tab of the ribbon.

We have to set the submit connection to save the form on the targeted library. Add new Data Connection:

Wait for the ‘Data Connection Wizard’ to pop up. Now, Select ‘Create a new connection to:’ and ‘Submit data’.

Next Select, ‘To a document library on a SharePoint Site’.

Set the target for library and the name of the form to be saved on each request submitted. On File name add ‘RequestNumber’ form field: Note: Request Number will calculate a unique ID which I will explain on next step.

Give the connection any name and make it as default submit connection. We have to change the submit option to leave the form open after submit because by default it set to close the form after submit.

Steps:

Ribbon menu >> Data > Submit Options >> then expand advanced options >> change the value of after submit to be ‘leave the form open’.

Now for the ‘Form Load’ rules.

  1. Rule 1: Now we have to check when the form opening if it’s new request or existed request. To switch the view either to edit mode or read only view.

Steps:

Under the data menu from ribbon menu >> click on Form Load

Add new Action rule with condition.

  • If the ‘RequestNumber’ is not blank.
  • Then run these actions…
  • Switch view to Read Only View.

Important – Click on don’t run remaining rules option; to only execute this rule only if the condition is met and not continue the rules (Break Action).

The rule window will be like below screenshot.

  1. Rule 2: Build and calculate the Request Number dynamically if it’s new request. By set following formula on the field “RequestNumber”, concat(“Vacation”, “-“, userName(), “-“, now()).

Steps:

Add new Action without condition and Run these actions: Set a field’s value.

So, on Form Load rules window will be like below

Now for the Submit Rules…

On submit button we will save the Form data to SharePoint Library.

Using the previous Data connection stated in above steps, do the following.

Then switch the view to ‘Thank You View’ which is created to above steps also.

Steps:

Select the submit button then right click >> Properties.

Under drop down Actions select ‘Rules and Custom Code’ option.

Then Click ‘Ok’.

Now click on form Ribbon menu >> Home >> Manage rules to show all the rules.

Now, select the button again then add new rule from the rules window.

We can add condition to validate or we can leave it none. Then under ‘Run these actions’:

  • Add submit data action then select the pervious data connection created.
  • Add switch view action to switch to ‘Thank you view’ created above.

The final view will be like below screenshot:

One option we have to consider is the form ribbon menu has options which should be hidden.

To hide it from The InfoPath designer >> File Menu >> Form Options.

Publish the form File Menu >> click on Quick Publish.

Congratulations, the InfoPath form level and we can test it in SharePoint by adding new item on the Form library and check the Request Number.

It will generate number like below – Request Number: Vacation-Username-2012-01-25T16:21:35.

About the author 

Larry Saytee