The service “SetWebPartProperties” is used to set or update properties of the WebPart parent webpart (the webpart the service runs in). This could be accomplished by determining the value in a datasource and dynamically setting the property from the properties on the webpart canvas, but it can be helpful to do this in a process canvas and with the SetWebPartProperties service since it gives you access to a process canvas before setting the property.
This service can be used where we are required to disable the WebPart, change CSS, change verbiage, etc. A single SetWebPartProperties service can set multiple WebPart properties.
SetWebPartProperties Use Examples
Basic Use Example
In this example, we are going to look at the list functionality in EASYCommerce. Lists are a feature that allow users to keep a list of items to reference later or add to cart. We are looking at the add list items webpart which allows you to add new items to the list.
In this example we are going to be looking at the WebPart onload process for this WebPart. First, we run an inquire service to query the database and get the userId of the list’s creator. Then, we compare the current user to the user that created the list. If these userIds don’t match, we then run the SetWebPartProperties service and update the WebPart property of disable to a value of “True”. In the above image of the add to list webpart, you can see that the all the fields on the page are greyed out indicating that they have been disabled. None of these fields are clickable because they have been disabled.
Here is the SetWebPartProperties service configuration. Notice it does not take a WebPartId because all property changes affect the parent WebPart (the WebPart the service runs in).
Below you can see the logs that run for this WebPart onload process. The SetWebPartProperties service does not have any output data.