Merge Opportunities with Flow
I’ve been eagerly anticipating the new Lightning Flow Builder for months. So, I was giddy, in a very geeky way, to finally have a reason to build a new Flow after the Spring 19 release.
The chance finally came when discussing the need to merge opportunities. Specifically, to merge products from two opportunities together into a single opportunity. There are apps on the app exchange that do this, but I really wanted to use Flow. I began by outlining the steps that should be taken to walk users through the process. Then, added in some details until I had a good ideas of all of the scenarios that were allowed and not allowed. Some of the things that had to be considered were:
Currency: The Opportunities needed to be in the same currency.
Price Book: The Products all needed to be listed in the same Price Books.
Record Type: Business rules that prevent certain types of Opportunities from being merged.
Duplicate Products: Don’t produce duplicate Opportunity Products during the merge.
The whole flow was pretty large, but the new designer made it manageable to navigate and reorder as needed. Here is a snapshot of the Flow.
I followed the guidelines for displaying flow stages with a Lightning Component to the Flow to give users a sense of progress through the wizard, added SLDS classes within text templates helped to spruce up some of the screens, and used the sweet Lookup Component from Alex Edelstein.
Here’s an example of the flow on a couple of test Opportunities. (Yes, I like to use Pearl Jam as my test account. Don’t hate. I graduated high school in 99’.) In this scenario we have a Renewal Opportunity for a one year subscription to a product. The same Account is also interested in a new product. They would like to co-term the two subscriptions. This can messy when there are several products. So, this wizard walks the user through the following stages to make it clean and simple. The flow is launched from a flow action on the Renewal Opportunity (Master).
Search: Find an Opportunity to merge with the Master Opportunity.
Verify: Make sure that the user has the selected the correct Opportunity
Validate: Runs the checks mentioned above to ensure these Opportunities can be merged
Confirm: Give the user a chance to commit and provide a reason for the merge.
Complete: End with a success message.