ClearList Use Examples
Basic ClearList Use
In this webpage we have a list named “Number List”, and the “Submit” button has a process with “ClearList” service. When the service runs, all the list values are cleared.
Here’s a closer look at the “ClearList” service with its inputs.
This services takes “ListName” as the input.
The actual field Name has to be passed as input and not the display name of the field. Here are the properties from that List on the webpart canvas. We can see that the value used is “Name”.
Note: Only one list can be cleared at a time. You should use multiple ClearList services if you would like to clear multiple lists.
This is how the field looks on a webpage after the service runs.
In the output logs, we can see “True” or“False” indicating whether the list has been cleared or not.
Using ClearList with “Auto Post Back” and Filtered Lists
In the following example, we have a popup window to Save the rule for a promotion as an admin. The user will arrive on the page and have multiple drop down lists to select various options for the promotion.
Some of these drop down lists have a property called “Auto Post Back” turned on.
This means that after the user has made a selection, it will post the page and rerun the datasource. This time, it will run, looking at the value selected on the page by the user, and filter the next drop down list below it to have only data relevant to the user’s selection.
One way to do this is first clear the list of its existing records, then populate the list with the new relevant values.
This is something we need to think about when Auto Post Back is turned on. What values will already exist on the page? This is not something we normally need to worry about when the page loads only for the first time.
Here is what that looks like in the process canvas. Notice that to clear multiple lists, we must use multiple ClearList services.
This clears both of the drop down lists specified. The next step would be to populate the drop down lists again, but with the new relevant values. In the screenshot you can see the SetControlProperty is doing this for both drop down lists.