Use Case: Clone Assets To Opportunity Products
I received this case to auto-create Opportunity Product or Quote Items based on the Account Assets. This is actually one of my dream feature that is still not available, so let’s build it in flow!
Before we start, we have to understand the difficulties of this action. While Asset has lookup to Product object, Opportunity Product has lookup to Pricebook Entry object, which is a junction object of Pricebook and Product. In order to get Pricebook Entry Id, we need to find the Pricebook Id too (Comment below if this needs more explanation and I can write another article).
The flow will then focus on how to get the right Pricebook Entry Id. Also, since you can sync the Quote Items from Opportunity Products afterward, here we only focus on how to clone from assets to opportunity products.
Lulu Mobile has several subscription products and they use the standard Asset object to keep track of each customer’s purchase. There are different asset statuses: auto-renew, free, and trial. They want a solution to get the assets from the account and populate them to opportunity products automatically if the assets have the auto-renew or free status. They also want only the assets with “Not Billable” unchecked to be cloned.
As we cannot be sure if a pricebook is already chosen in the opportunity, we want to use a screen flow and let the users choose the right pricebook if it is still empty. We will then get all the assets that meet the criteria, loop through them to get the Product Id, and then get the Pricebook Entry Id. After that, we can create opportunity products in bulk.
We will launch it with quick action for users to decide when to clone the assets.
Screen Flow | Assignment | Variable/Collection |
Record Id | Create Records | Input Variable |
Screen | Get Records | Loop |
Decision | FormulaFormula |
Does the solution solve your problem? If not, write us what your problem is and we will build the flow for you!
Any chance you have a use case that is the “flip” of this? When an Opportunity is marked as Closed Won, create Assets from the Opportunity Products
Hi Megan,
Of course. It should be fairly easy to build because you don’t need to get the pricebook entry when you are looping through all opportunity products. You only need:
Do you need a detailed walkthrough like this one above? If so, I can write another post and schedule it (but it will take several weeks before it can be published)
Let me know!
Hi Melody,
I would really appreciate this! Even if you can’t do a whole post if you could expand on the bullet points above that would be amazing.
thanks!
Hi Vicky, no problem. I will write a post with detail steps then since it sounds like a common use case. It will take several weeks before I can publish it though, so stay tuned!
Hi Megan and Vicky, I have arranged the solution into the schedule, but now it might take too long before I can publish it, so here are the steps for this solution :)!
Since this has to happen after Opportunity is changed to closed won, we create a record-triggered flow instead of a screen flow.
The trigger should be “when updated” and “after save”. The start condition should be Stage = Closed Won, with “Only when a record is updated to meet the condition requirements” option.
1. Get Records – Get All Opportunity Products where Opportunity Id = $Record.Id
2. Create a record single variable for Asset (ex. varAsset)
3. Create a record collection variable for Asset (ex. allAssets)
4. Loop through all products:
4-1. For each Asset: Update the varAsset fields with the fields from current item (current opportunity product)
4-2. Add varAsset into allAssets
5. Create Records – create Assets with allAssets variable
This one should be simpler than the solution above. Give it a try and let me know how it goes!
Thank you Melody. I keep getting an error where the records can’t be found? If you get chance to post the full walkthrough that would be really helpful.
Fingers crossed you get chance soon!
Has this been published now? this is a scenario i am working on building to create “purchases” record for each opportuntity line item at the account level when the opportunity is set to closed won.