function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mstrattmstratt 

Products and Opportunity Validation Rule

I created a validation rule so that after an opportunity reaches a certain stage, it is required to enter the products. Otherwise, you cannot save the opportunity.

 

Unfortunately, when you create a new opportunity, there is no option to add products. I've tried editing the page layout, but you cannot move the related list (products). 

 

Please help!

Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

You cannot attach Products to an Opportunity when you are in the act of creating a new Opportunity, because until you "save" the Opportunity (and Salesforce assigns a Record Id) there is no entity for the Products to be connected to.  

 

In the Opportunity settings there is a checkbox

 

Prompt users to add products to opportunities

 

This will update the standard "Save" button to "Save and Add Products" and give the user the option of going directly to the Add Products menu, or selecting cancel and just saving the Opportunity "as is" without Products.

All Answers

Steve :-/Steve :-/

You cannot attach Products to an Opportunity when you are in the act of creating a new Opportunity, because until you "save" the Opportunity (and Salesforce assigns a Record Id) there is no entity for the Products to be connected to.  

 

In the Opportunity settings there is a checkbox

 

Prompt users to add products to opportunities

 

This will update the standard "Save" button to "Save and Add Products" and give the user the option of going directly to the Add Products menu, or selecting cancel and just saving the Opportunity "as is" without Products.

This was selected as the best answer
ceecee

One additional comment:

 

We also have a VR to require Products at a certain Stage. However users were later removing products and the VR wasn't catching that. So we have an additional VR to ensure the last product is not removed.  This required creating a Roll up Summary field (Products_RUS_c) to count the nr of records in Products.  The last line is just our org's requirment to avoid the VR firing on older records. 

 

Error msg: WARNING! Check the Stage before deleting the last Product!
In order to remove all Products, the Stage must be set to something other than Target or Close - Won.

 

AND
(
OR
(
ISPICKVAL(StageName,"Target - Commitment"),
ISPICKVAL(StageName,"Target - Negotiation / Review"),
ISPICKVAL(StageName,"Target - Final Agreement"), 
ISPICKVAL(StageName,"Close - Won")
),
Products_RUS__c  < PRIORVALUE (Products_RUS__c),
NOT ( HasOpportunityLineItem ),
CloseDate > DATE(2012,12,31) )