Link to home
Start Free TrialLog in
Avatar of Jeff Perry
Jeff PerryFlag for United States of America

asked on

How to Convert a Quote to an Order in SalesForce

I am having a hard time trying to figure out how to take a quote and convert it into an order in SalesForce.  What I want to accomplish is after I have quoted something with line items and all.  Once the quote gets accepted I then want to convert that into an order.  Carrying over all the line items and account information.  I am trying process builder and got the order created but just basic data is there.  I need all the data from the quote to carry over.

Is there anyone that can assist me with this.
ASKER CERTIFIED SOLUTION
Avatar of Anastasia D. Gavanas
Anastasia D. Gavanas
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jeff Perry

ASKER

Thanks for your help.  That is about all I found in my research as well.
I know this is closed but for future readers, you can do this via Apex as a trigger.  
The pseudo code is:

Loop through closed Opportunity (Quote) records to find ones that qualify
For each qualifying Quote, create a new Order and add to a list (e.g., ordersToUpdate)
For each qualifying Quote, get the corresponding QuoteLineItem rows to repeat process for new OrderItem objects
Once you have your list of objects to add to the system, insert them in bulk

If you want to get fancy, you can do this async, so the trigger finishes with a simple load of a job or future call that then does the heavy lifting to go find the Quote data and create Order data since it will be a bit involved if you have many lines per Quote and many triggering at the same time if you are doing any other automation.

If you need help with the syntax, you can launch a new question.

Anyway, just leaving this here for others to know there are solutions.  In fact, the Trailhead (Developer courses) takes you through exact scenario.  They just may use creating a Task after closing a Work Order or whatever generic case may be but concept is the same as you need to take information from the closed object and move it to new records in a way that honors the governor limits, does not cause the users pain and is maintainable.