Skip to content

Validation Rule: Quote must be synced in order to mark the Opp as Closed Won

Last updated on September 15, 2022

DESCRIPTION

Let’s say, you want to make sure that if an opportunity has a quote then it must be synced with the opportunity in order to make the opportunity stage Closed Won. To achieve this requirement we can make a validation rule. But to make sure that the quote has at least one quote, we will have to create a roll-up summary field.


SOLUTION

Step 1

Create a roll-up summary field on the opportunity object to count the number of quotes related to the opportunity.

Opportunity Roll-up summary field: Number of Quotes

Roll-up summary field on the opportunity to show the number of quotes

Step 2

Create a validation rule on the opportunity object, that validates that if the opportunity has a quote then it must be synced with the opportunity in order to update the opportunity to closed won.

Created a validation rule: Opportunity_Must_be_sync_with_the_quote

AND(
ISPICKVAL( StageName , "Closed Won"), 
ISCHANGED( StageName ),
Number_of_Quotes__c > 0,
ISBLANK( SyncedQuote.Id )
)

Error Message: Please sync the primary quote in order to update the Opportunity to Closed Won.