SharePoint Calendar – Adding entries from BPS Workflows

Facebooktwitterpinterestlinkedinmail
Applies to version 8.3.1.x; Author: Kamil Nędza

With WEBCON BPS it is very easy to communicate with SharePoint lists. By using BPS Designer Studio and the most basic and standard actions it is possible to add, remove and edit list elements. New elements can be added to the list from a workflow form directly, without previously adding those values manually to the data source. This feature can be used to inform employees about events, tasks, deadlines etc. The range of scenarios is large and varied.

This article describes how a SharePoint calendar (which is also a list app) can be used to enrich a very basic delegation process – Information about which company cars are currently in use, and which are available, is displayed on the SharePoint form as a calendar.

1

Creating necessary SharePoint lists:

For this example, we will store information about each individual car in separate calendars, so we can start by creating a number of calendars equal to the number of company cars. To add a calendar, go to Site contents and click add an app.

2

 

From the selection of available applications, choose Calendar.

3

 

After the calendars are created, should be visible amongst other site apps:

4

 

With the calendars done, create one more app, a Custom list which will contain the names of all company cars.

5

 

Fill out the list with car names, our example only had 2 cars: Opel Astra and Fiat Punto, and so they were added to the list:

6

 

Using the car list as a data source:

In Designer Studio, go to the Data sources tab. Add a new Data source and select SharePoint list as the type. Provide the location of the list in the SharePoint settings section and save the newly created source.

7

 

Delegation process configuration

Car choice field

Add a Choice field type form field named Car. Set the SharePoint list you created as this form field’s data source. This form field will appear on the form as a picker field, and allow the user to choose a car from the SharePoint list

8

 

Next, configure the form field settings by clicking Advanced configuration.

9

 

Date & time

We will also need two standard Date and Time type picker fields, one for selecting Start dates and one for End dates.

The icon that appears next to Date and Time picker fields will open a pop-up calendar for date selection.

Optional form fields

Certain additional fields can be added for extra context, but are not necessary for the calendar to work. In this example, I’ve added two Single line of text fields for entering the destination and client (in a realistic scenario, these would probably be picker fields with their own data sources and autocomplete enabled).

In addition, create a Single line of text technical form field. Its purpose will be to store the ID’s of elements created on the SharePoint list. Thanks to this, it will be possible to remove this element from the list in the future (removing elements from a list isn’t covered in this article), if the delegation request was rejected or annulled.

10

 

Note: Don’t forget to make your form fields visible in the Fields Matrix tab of your workflow configuration. You can also make the important fields ‘required’ – meaning that the user will be blocked from moving to the next step unless they fill out the required fields.

Actions for adding elements to lists

Now it is time to create actions which will make entries to the SharePoint list. Decide on a trigger which will launch these actions (in our example, we went with ‘On path’ type actions on the Register path – which means that clicking the ‘Register’ path button on the SharePoint form will launch these actions). Create an action for each car that you defined, in our case its one for the Opel and one for the Fiat.

 

First, let’s configure the action that will be executed when the Opel Astra is chosen.

Since we want the action to execute when the Opel Astra is chosen in the Car picker field, we need to define an SQL execution condition which will allow the action to be executed only if the ID of the chosen value matches the Opel Astra’s ID in the Cars SharePoint list (On our list, that ID is 2).

 

Explanation:

When a value is selected in a choice field, the actual value that is transmitted through the system looks like this:

ID#ChosenItemName

Where the ID portion is the value’s ID in the data source from which it was taken (for us it is the Cars SharePoint list), and the ‘Name’ part corresponds to whatever the chosen item’s name was on the form. So in our case, the full transmitted value is: 2#Opel Astra

 

Below is an example of an SQL condition which checks the ID portion of the value transmitted from the Car form field. If that ID is 2 (which corresponds to the Opel Astra on the SharePoint list) the action will be executed.

11

 

In the configuration screen, use the Select button to specify a path to the relevant calendar app (Opel Astra calendar).

This should automatically load a list of elements associated with a SharePoint calendar, the ones that are necessary for it to work are: Title, End Time and Start Time.

The start and end times are obvious, find your Date and time form fields in the reference tag tree on the right-hand side of the configuration screen, and double click to enter them into the corresponding Value rows (or toggle the Switch to advanced mode checkbox and type in the tags manually). The End and Start Time parameters of the SharePoint calendar will now obtain values from the Date and Time form fields.

For the Title, you can combine multiple tags to create a more complex and descriptive name. We recommend using the Author tag (System fields -> Information) combined with one other system field (e.g. Date created) or form field (e.g. Destination).

12

 

Now repeat this process for the first car (Fiat Punto). If you have many cars and thus need multiple actions, you can clone the configured action to save time. Just remember to change the car ID in the execution condition and the SharePoint calendar address for each action. We also recommend that you alter the action names – for the sake of transparency.

13

 

14

 

Testing

Launch the delegation workflow that you just configured. Fill in the necessary data and register the workflow element. In our case, the actions for registering events in the SharePoint calendar were hooked up to the Register path. When clicking to traverse the Register path, an event with the provided start and end dates is created in the selected car’s SharePoint calendar.

15

 

After registering the workflow element, open the calendar for the chosen car. An event should be registered for it, like so:

16

Multiple calendars on one view

SharePoint allows you to display multiple calendars (max 10) in one. To display additional calendars on top of another, go to the Calendars tab on the SharePoint ribbon and select Calendars Overlay.

17

 

In the Calendar overlay settings, calendars can be added into the view. Click New calendar to include an existing SharePoint calendar.

18

 

After filling out the data, save by clicking OK. For this exercise, I’ve created a separate SharePoint calendar named Car Calendar, where I’ve included my two individual car calendars (Opel Astra and Fiat Punto) in the overlay:

19

 

What next?

Thanks to the integration of workflows and SharePoint calendars, we created one compiled view in the form of a calendar, which clearly shows which cars are reserved on what days. Keep in mind however, that if someone manually deletes an event from the SharePoint list, it will have no effect on the delegation workflow. For this reason it is important to block unwanted users from editing the SharePoint list, and make the delegation workflow the only means through which regular users can edit that list.

The example we discussed above includes only the most basic function of adding entries into the calendar. In order to enhance and expand the process, you can try and implement the following suggestions:

  1. On the delegation workflow form (preferably on the registration step) add a link to the SharePoint calendar with an overview for each car. Thanks to this, a user wishing to register a delegation will be able to find out which cars are available.
  2. Add an action for removing entries from the calendar (making use of the technical form field “[TECH] ID”), if the delegation element is rejected or if it is unexpectedly canceled, this information will be reflected on the SharePoint calendar.
  3. Add a date validation mechanism on the register step. Verify whether or not certain dates collide before they are entered into the calendar.

Leave a Reply

Your email address will not be published. Required fields are marked *