Hi there,
I need to create a quote on an opportunity once the stage on the opportunity = quoting. I also need to be able to automatically sync all opportunity product line items to the quote. Any ideas?
Thanks,
Ashmita
Hi Ash,
I have done this before. It is very tricky and you will need a Flow to do this.
The Problem of auto syncing a quote with its related opportunity at quote creation is that the synchronisation must occur only when all Quote Product records have been created. If you update the quote record synced opportunity id when the quote is created, the modification will be committed before the quote lines are actually created, resulting in syncing a quote with no line item, therefore removing all current Opportunity Product records on your opportunity.
The solution I found is the Following:
- Create a record triggered Flow on the Quote Product object (not Quote)
- Set trigger to "After record is created"
- Create a Get Record action to get the created Quote Product information
- Create a Get Record action to get the parent Quote information
- Create a loop that loops over all the current Quote Products of the current Quote, including the one that was just created
- In each loop occurrence, increment a currency variable with the value of the quote product
- Create a Get Record action to get the parent Opportunity information and store the total amount in a variable
- Create a decision and a field update that does the following:
- If total quote amount = opportunity amount, sync quote (update Opportunity SyncedQuoteId)
- If total quote amount <> opportunity amount, do nothing
By doing this, you make sure that the quote will be synced as soon as all quote products have been created.
I hope that helps.