Step-By-Step Build Advanced InfoPath Form and SharePoint Designer Workflow
Step-By-Step Build Advanced InfoPath Form and SharePoint Designer Workflow
Net
Steps:
On InfoPath Designer:
1-
Create New SharePoint Form Library and set the target SharePoint Site
Create following objects on the Form:
Five Fields:
-
2-
Two Buttons:
-
3-
RequestNumber (String).
Justification (String) multi line Mandatory
StartDate (Date). Mandatory
EndDate (Date). Mandatory
Submit.
Cancel.
Three Views:
-
MegrenDotNet | www.Megren.Net
Default View (edit mode) snapshot
MegrenDotNet | www.Megren.Net
Check Read only option then click on OK.
Now on the read only view remove all the buttons and add new to close the form and set rule to close the form
So, the final view of read only will be like below snapshot:
MegrenDotNet | www.Megren.Net
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 request.
MegrenDotNet | www.Megren.Net
Add target SharePoint Site URL
MegrenDotNet | www.Megren.Net
Name it Vacation Request
MegrenDotNet | www.Megren.Net
Expose the fields to SharePoint
By adding following fields as columns on SharePoint Form Library
-
Request Number
Start Date
End Date
Justification
MegrenDotNet | www.Megren.Net
Use add connection wizard:
Submit data
To a document Library
Set the target for library and the name of the form to be saved on each request submitted
MegrenDotNet | www.Megren.Net
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.
MegrenDotNet | www.Megren.Net
Steps:
Ribbon menu >> Data > Submit Options >> then expand advanced options >> change the value of after submit
to be leave the form open
10
MegrenDotNet | www.Megren.Net
On Form Load Rules
1- Rule one:
Now we have to check when the form opening if its 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
Important! Click on dont run remaining rules option; to only execute this rule only if the condition is met and not
continue the rules (Break Action)
11
MegrenDotNet | www.Megren.Net
2- Rule two:
Build and calculate the Request Number dynamically if its new request.
12
MegrenDotNet | www.Megren.Net
Steps
Add new Action without condition
Run these actions:
Set a fields value
13
MegrenDotNet | www.Megren.Net
Submit Rules:
On submit button we will save the Form data to SharePoint Library
Using the previous Data connection carted on above steps
Then switch the view to Thank You View which is crated to above steps as well
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
14
MegrenDotNet | www.Megren.Net
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.
One options we have to consider it is the form ribbon menu has options which should be hide
15
MegrenDotNet | www.Megren.Net
To hide it from The InfoPath designer >> File Menu >> Form Options
Congratulation, the InfoPath form level and we can test it from SharePoint by add new item on the Form library
and check the Request Number
It will generate number like below
Request Number: Vacation-Megren-2012-01-25T16:21:35
16
MegrenDotNet | www.Megren.Net
SharePoint Designer 2010:
We will design a Workflow to assign Approval Task Process to be associated with our pervious Vacation
Request library and customize the task form:
Steps:
Open SharePoint SPD and connect to the site contain the targeted document library open workflow menu
form the side navigation window.
Form the ribbon menu click on List workflow and pick our Vacation Form library need to associate the workflow
on it.
17
MegrenDotNet | www.Megren.Net
Workflow Editor Window will opened
From the ribbon menu add action inside task action sector chose Start Approval process
18
MegrenDotNet | www.Megren.Net
We will see a new action added as a line on the workflow editor
Were going to set task process participants users, by clicking on these users link
And pick the users from SharePoint groups or single users.
19
MegrenDotNet | www.Megren.Net
In the first field add the participants IDs and there is an option to send the task to the users I in parallel or one
at time (sequential)
And here is snapshot for sequential approval task for 2 exists groups
From top to bottom
So the task will be assigned to Hierarchy Managers group if approved Approvers group
No need to add any title or instructions but may you need to set the task duration time and due process date if
required.
Finally we need to trigger this workflow when an item added to the document library.
So, we have to click on Workflow settings form the ribbon menu.
Then under Start Options check box of start workflow automatically when item created as below
20
MegrenDotNet | www.Megren.Net
Save and publish the workflow from the ribbon menu.
You will noticed that after publishing a new Task form added on the workflow Forms
This form will be opened by approvers to approve the vacation request or reject it.
We can open it by click on it form the same window above.
It has only requester Name and little information related to the task.
21
MegrenDotNet | www.Megren.Net
You need to get the request data (Vacation Start Date, Vacation End Date and Justification)
How fetching Requests Data to Form Task?
Steps:
On the Task Form add a new connection >> Data Menu >> Data Connection.
Choose receive data option
22
MegrenDotNet | www.Megren.Net
Put the SharePoint site that has the Vacation Request form library
23
MegrenDotNet | www.Megren.Net
The following window shows us the available fields on the selected library
24
MegrenDotNet | www.Megren.Net
Note: highlighted fields shown here because the previous step when initiating the Vacation Form we expose
these fields. We will select all of them plus the title field.
25
MegrenDotNet | www.Megren.Net
On the last screen uncheck the automatically retrieve option then click on finish.
Important If checks this option it will bring all the requests and maybe affect the site performance!!!
We have the connection but we need to get only the currant task related request data.
If you remember what we have the request number as a unique value so we will use it
How to do that?
On the Task Form Load
Add rule to set vacation request connections to bring only the item which has the same tile of the task related.
Add new rule
Run these actions:
Set a fields value of the new created connection query title field to be the currant task related task discretion
26
MegrenDotNet | www.Megren.Net
Click the field to be set and click on show advanced view option
Select the vacation request connection (secondary) >> under query fields select the title which we will use it for
the query.
27
MegrenDotNet | www.Megren.Net
28
MegrenDotNet | www.Megren.Net
29
MegrenDotNet | www.Megren.Net
The final form load rules actions will be like below:
30
MegrenDotNet | www.Megren.Net
Explore the fields and add them to the task form as extra details or table
Submit new vacation request the check the document library new item
You will notify that, there is a new column added named as workflow name Vacation Request
31
MegrenDotNet | www.Megren.Net
Lets click on the In Progress link and check the task assigned
Now we will open the Task form to check the request as an approver
32