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
Ramya VelusamyRamya Velusamy 

Can not change Sales Price if the product is standard in opportunity object

Hi, In opportunity object if we are selecting the standard product then salesprice should be read only i.e not editable. if it is custom product we can edit. Kindly help me to do this task.
User-added image 
Chandra Sekhar CH N VChandra Sekhar CH N V
You can set up a validation rule on OpportunityProduct object and use 'IsStandard' field to determine whether the pricebook is a standard one or not.

It would look something like this (not exact one...tweak it as per your requirement)
(ISCHANGED( UnitPrice)) 


Actually the concept is on opportunity with Opportunity line item is.

There is a Junction object between Product and Pricebook which is called PricebookEntry. And when ever we need to add ProductLineItem on Opportunity than we just need to provide PriceBook entry Id to ProductLineItem to make relation between opportunity and product with Price and than provide some other param like qunatity and Unit Price. Once you add first line item on opporutnity than opportunity have a field Pricebook2Id which maitain the which price book has been applied to this opportunity, if you try to add any other line item which is belong to another price book than you will get an exception.

Ashlekh Gera