Empty Opportunity/Quote Basket
- Kriss Lugo
- Apr 26, 2021
- 1 min read
Updated: Apr 26, 2021
Based on this Idea.

First Step: Let's create a flow!
Select a Screen Flow (Step #1)
Drag and drop your first screen element
Add a Toggle (I liked the idea of a Toggle, but you can use radio buttons, picklist)

Drag a Decision element (Step #2)

From here we will have (2) options:
Empty the basket:
Drag a get record element (Step #3)
Let's find all Opportunity Products where the opportunityId = recordId
Choose fields and let Salesforce do the rest (Only store the ID)
Drag a delete element (Step #6)
Use the IDs stored in a record variable or record collection variable
Select the collection from your "Get record"
Do not empty the basket:
Drag a screen element (Step #5)
Add a Text component: You basket was not emptied! (To reasure that we did not do anything wrong)
Now we want (3) more screen elements:
End Screen: Add a text component (You basket was emptied!) (Step #4)
Error #1: Add a text component (We hit a snag! We couldn't find any records related to this opportunity.) (Step #8)
Error #2: Add a text component (We hit a snag! We encountered some errors while performing this action. Please contact your system adminsitrator and send the following information: Error: [FLOW] Empty Basket - STEP #6: Delete - {!recordId}) (Step #7)
Finally let's connect everything and Activate!

Second Step: Let's add the flow to the opportunity page
Go to the Opportunity object under setup.
Navigate to: Buttons, Links and Actions
Create a new action
Select: Flow
Select the flow you just created
Give it a name
Now to Page Layout and add your new button to your opportunity page
You can now take this flow as an example to build the solution for Quotes.




Comments