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
Siddharth PrakashSiddharth Prakash 

How to set a default value in opportunity products field ?

Hi all,

We have added a field that needs to be checked for a certain price book and needs to be unchecked for others. Please advise if this is possible when we are adding a product.I am just wondering if this is possible by trigger but my developers are suggesting that it has to be done using a custom visualforce page and is not possible using standard functionality. Please advise.

Regards
Siddharth
KaranrajKaranraj
Do you want to display the checkbox field while you are creating or editing field? or you are ok with checking or unchecking the checkbox field after the record creation if so then you can achieve this using any of this two methods

1. Create workflow rule to update the field based on the pricebook
2. Create that checkbox field as formula field to check or uncheck based on the pricebook.
Note:- Formual field is readonly and you can't change the value manually.
Siddharth PrakashSiddharth Prakash
Thanks for the quick reply.The customer wants the checkbox to be default checked as soon as loads the product.
I think both the solutions above work only when the record creation has occured 

Regards
Siddharth
KaranrajKaranraj
Then only option if you want to update field based on the pricebook is visualforce page. Create a visualforce page with standard controller then override the "New Product" button with your custom visualforce page
Siddharth PrakashSiddharth Prakash
Thanks. Before i go down that path, i need to be sure that there is no other way.