+ Start a Discussion

Partner Portal User: Pricebook identification


When a  partner portal user saves an opportunity, I need to check whether that opportunity has a associated pricebook or not. If not, then pricebook shared with partner portal user role should be attached to opportunity.


I am not sure how to get the pricebook id for partner portal user. Please help.


Thanks in Advance,



Whenever you share any object with any user or usergroup , a related child object  called <objectName>Share say PriceBookShare is formed from where one can retrieve the id of the "Pricebook" shared with a particular group.


Select p.UserOrGroupId, p.Id From PriceBookShare p where p.UserOrGroupId=<PartenerPortalUserId>


Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.



if pricebooks are set to private in the default sharing settings and only one pricebook is visible to the user (no matter if portal user or full user), then that pricebook will be assigned automatically to opportunities created by the user. No need for apex.


Or are you talking about existing opportunities created by other users?




Thanks for reply.. But this query is not working when i run into eclipse. It is showing me like "INVALID_TYPE sobject does not support pricebookshare"