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.