You need to sign in to do that
Don't have an account?
Deep Clone Opportunity with Products via Visual Workflow?
Here is the use case: Sales person doesn't close the sale this year :( They click a button on Opportunity page layout which launches a loss analysis flow where we capture useful information like who we lost it to, why we lost it, notes about how this went down, etc.
One screen asks the user if they want to create a follow-up Opportunity for next year. If they choose "Yes," I'd ideally clone the entire Opportunity record with all of its products and just adjust things like Stage and Close Date using the flow.
I know I can't achieve this without an Apex plugin, and I was wondering if anyone out there has one built that can handle this, or can assist me in getting something like it developed. I am not an Apex developer, but I can find my way around some code if I have something to start playing with.
Thanks for any guidance.
The decision criteria is
{!mylookupelement} equals {$GlobalConstant.true}
Hope this helps.
Raja
All Answers
You can loop through the lines and create a new line for the opty in a flow.
Thanks, Rajaram, I'm sort of following but don't really know how to get started. Any chance you can share some sample code? Right now, the button that launches the flow passes the Opportunity ID into the flow. It's just a matter of how I can go about looping through and cllecting each line item to reparent to the newly cloned record in the flow.
1. Create a loop in your flow which queries the opty lines for the opty ID you passed
2. To ensure you get to process all the lines, you have to create a custom field on the opty line and use that in the filter criteria.
For example, create a field called "processed" which is a checkbox and use that in the filer. so your filter for the record lookup will be optyID = {!myOptyID} and processed equals false
3. In the loop, update that line and set the processed to true. THis will ensure the line will not be queried again in the loop.
Hope this helps..
Raja
Ok, I get it now.
So I tried creating the loop as you described...I use a record lookup to find Line Items where opportunity id = {!myopptyid} and Processed__c = false and store the line item ID in a variable called oli_id. Then, we go to a record update step which updates Processed__c to True where Id = {!oli_id}. Then I send the flow back into the line item lookup. Here's in image of the loop: Flow Loop Error
When I send the flow out of the loop, there is a FAULT notification between step connectors. When I try to run a test, I receive the following error:
Limit Exceeded
You or your organization has exceeded the maximum limit for this feature.
Any idea what's going on here? I'm guessing it has something to do with the oli_id variable?
The decision criteria is
{!mylookupelement} equals {$GlobalConstant.true}
Hope this helps.
Raja
Brilliant! Raja, thank you for your input, this has helped me tremendously. You are a wizard!
Happy to help..
Happy flowing!