0

Description : I am overriding the functionality of Add Product button through code (which is present in related list of Opportunity, in Opportunity Line Item.)...i need to check is Price Book added for the current Opportunity or not, how can I check it in my code?

Thanks in Advance.

2
  • Yes check Opportunity.Pricbook2ID null or not
    – Ratan Paul
    Feb 12, 2016 at 12:26
  • Faiz Cool . you solved your issue.
    – Ratan Paul
    Feb 15, 2016 at 7:49

2 Answers 2

3

There's a lookup on the Opportunity to pricebook called Pricbook2ID. Just query and check to see if it null.

From: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_opportunity.htm

Pricebook2Id

Type:

reference

Properties:

Create, Defaulted on create, Filter, Group, Nillable, Sort, Update

Description

ID of a related Pricebook2 object. The Pricebook2Id field indicates which Pricebook2 applies to this opportunity. The Pricebook2Id field is defined only for those organizations that have products enabled as a feature. You can specify values for only one field (Pricebook2Id or PricebookId)—not both fields. For this reason, both fields are declared nillable.

0
-1

Another helpful answer I found in the Link am sharing below:

https://developer.salesforce.com/forums/?id=906F0000000Ap9KIAS

I hope it will help a lot :)

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .