Visual Workflow Product Validation
We’re switching tracks just a little bit. This episode, we look at how we can use Visual Workflow to validation Opportunity products when we Close Win an Opportunity.
This Flow takes advantage of what we’ve learned in previous episodes. We’ll use a Fast Lookup to get our Opportunity Products. Then we loop through each product and make a decision on what type of product they are. We use assignment to help count the type of each of our products. Finally, we have a decision that will result in either a Screen to the user with an error message or a record update and update the Opportunity.
Why use Flow to validate our Opportunity products? We know validation rules do not work well across sibling records (from one product to another product). Traditionally, we’re stuck with using either Apex or some sort of combination of roll up summary fields and validation rules.
Sometimes we don’t want a mixture of products and sometimes we do. For example, perhaps you don’t to mix a subscription product with a non-subscription product. Maybe you want to make sure you have an implementation fee with your software product.
In my situation, I don’t want to sell someone a bunch of ugly Yoda ears when they’re buying some awesome hats.
This Flow will set us up for our next video where we look at how we can use subflows.