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
cantchanandcantchanand 

Partner Portal User: Pricebook identification

Hello,

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,

Anand

Ispita_NavatarIspita_Navatar

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.

 

ahab1372ahab1372

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?

cantchanandcantchanand

Hi,

 

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"