Applies to version: 2016.1; Author: Kamil Nędza
SharePoint lists and CAML
While working with WEBCON BPS, one may create multitudes of different types of data sources. One of the most common and easily implemented type of data source is a SharePoint list. Putting together a list on the SharePoint site and configuring a connection to it in BPS Designer Studio is a piece of cake, allowing the list to be used as a dictionary for a workflow form almost instantly.
On production environments, SharePoint lists tend to get bloated as business needs increase. Sooner or later, there will come a time when the number of returned results is far too great and far too unorganized. It becomes necessary to be able to narrow down the displayed results using a few logic conditions. To do this we can use queries written in CAML – a markup language based on XML.
Anyone who had to manually prepare a piece of CAML code, will know that it is a time consuming process, and how easy it is to make a mistake when you are lost in a sea of markers. This is where the U2U CAL Builder comes into play. By using this free tool, it is possible to quickly come up with a query for filtering results.
This article will outline, step by step, the basic functions of this tool.
Examples of use
In a workflow for Technical support, a SharePoint list is used for storing data about employees. The list contains information about where the employees work, and what type of hardware they are responsible for. When selecting a type of hardware and location on the form, the ‘employee’ picker field will only suggest users that will be able to help. The field will display logins of all employees that are responsible for the selected hardware, and work either in the selected location or remotely. The SharePoint list has the following structure:
Step by step instructions
(1) First of all, install the program on the environment that has access to the SharePoint site containing the list. The download link can be found here: http://u2u.be/Software
(3) After logging in, select one of the visible SharePoint lists and click “New Query”
(4) Next, by using the available options, create the filter you wish to use. Use sample data to assist you – this way it is possible to easily test the query. To test the filtering query, click the “Result” tab.
(5) After making sure that the query is correct, copy it from the Editor tab and paste it in a SQL or CAML query configuration field of a Choice field in Designer Studio. Replace the sample data with variables available in Designer Studio. Our example ended up looking like this:
(6) Configure the form field to display desired values and save the process. Make sure that form fields whose variables where used in the CAML query have the “Change of value causes postback” option toggled on (in our example above, we used variables referencing the “Category” and “Location” form fields).
Did it work?
Go to the SharePoint form to verify whether this functionality was implemented correctly. On the screenshot below we can see that after selecting the “PC” Category and “Cracow” Localization, the values that are returned are employees that are responsible for PC equipment and work in Cracow or remotely: