Commonly when building flows, you need to have more than one user decide the path the flow should follow. This is common in a number of scenarios:
- Approvals: When a manager or team of people need to approve something before a flow can progress.
- Co-navigation: When both a customer and employee need to jointly confirm acceptance before a flow can continue.
- Polls: When a certain threshold of users want a particular action to be performed, the flow continues.
- And the list goes on…
As with all flows automated on the Flow platform, it’s common to need more than one person to get something completed.
Configuring your flow
There’s nothing specific about a Flow that can have voting enabled. Voting can happen at any point, however, it is only supported in the following Elements:
- Step: Add voting to simple steps in your flow.
- Page: Add voting to pages. When the first user clicks on an outcome to progress the flow, this puts all users viewing the flow into a “read-only” mode until they place their votes. This is to ensure data integrity of what is being voted upon.
The voting functionality is based on the authorization context of the map element in your flow. As a result, if the map element is running in a swimlane, then the voting is based on the users who are able to successfully authenticate in that swimlane.
If the map element is running as part of your flow without a swimlane, then the voting is based on the users who are able to successfully authenticate with the flow. As a result, there are a few important considerations with voting:
- The voting must be configured in a flow and/or swimlane that requires user authentication.
- Voting will not work for public flows as all users identify as a single “public” user.
- The service providing the identity/authentication for your flow should ideally be the same service providing the voting algorithm.
To add a voting to one of the above elements, you need to add the following JSON to the map element:
// Map Element definition
Where the properties are as follows:
|voteType||String||Though this is not limited in any way, the voting functionality is provided through the underlying service. For Salesforce, the service currently only supports “COUNT” and “PERCENT”. Developers can add additional voting types and algorithms using our Service SDK.|
|minimumCount||Integer||The minimum number of unique users that need to click on a particular outcome for the flow to proceed to the next step.|
|minimumPercent||Integer||The percentage number of unique users that need to click on a particular outcome for the flow to proceed to the next step (e.g. 75 would be 75%).|
|attributes||Key/Value pairs||Additional attributes that can help the service make decisions about how best to execute the vote. This allows developers to extend our metadata as needed.|