+ Start a Discussion
Suhas Pardeshi salesforceSuhas Pardeshi salesforce 

I want you to create Flow. When opportunity closed won, create Order and all the opportunity products should be available in order. with the help of flow, how can we implement it step by step,please guide

Suraj Tripathi 47Suraj Tripathi 47
Hi Suhas,

Please use record trigger flow to implement this.
Please follow these steps-
1. Goto Setup.
2. Search flow in the quick find box and select flow.
3. Create a new flow and select record trigger flow.
4. Select object Opportunity and add condition fire when the opportunity is Closed Won.
5. Now, Create a record from the left menu.

If you find your Solution then mark this as the best answer. 

Thank you!

Suraj Tripathi
Mandeep DekaMandeep Deka
This is not as easy as it sounds like. 

1. You will have to set the conditions for the Opportunity with Stage as 'Closed Won' and run the flow 'only when a record is updated to meet the condition requirements'.
2. Choose 'Action and related records'.
3. Assign the values for the fields on the Order object. You might need to map it from the Oppty object itself. Use the assignment element here.
4. Then use the Create record element to create the Order record.
5. After that, use a decision element to check if the oppty has line items.
6. If so, then get the oppty line items using a 'get records' element and store it in a collection variable
7. Using loop element, loop through the collection variable and assign the values to another OrderItem type variable.
8. Within the loop, keep assigning this OrderItem type variable to another OrderItem type collection variable.
9. At the end, after the last item, use the create record element to create the orderitem records using the OrderItem type collection variable created in previous step.

Hope this is clear.
Note: For adding the products, you will also need to assign the pricebook added in the oppty to the Order.