Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs
9 votes
Accepted

What does "Use" mean in Organization-Wide Defaults of Pricebook object?

Below is the snapshot of the access levels for Price book Please refer to this link for more information
Samir's user avatar
  • 2,679
5 votes

Test class pattern for pricebook when standard pricebook is deactivated

To be used in custom price books, all standard prices must be added as price book entries to the standard price book. So you will still need to define a standard price PricebookEntry sPBE = new ...
Eric's user avatar
  • 54.2k
5 votes

Find all Product2 records that do NOT have a PricebookEntry in the Standard Price Book

The Id column in your subquery is the Id of the PricebookEntry object. You want the reference field to Product2, Product2Id: SELECT Id, ProductCode FROM Product2 WHERE Id NOT IN (SELECT Product2Id ...
David Reed's user avatar
  • 93.1k
5 votes
Accepted

Pricebook and PricebookEntries with different currencies

One Pricebook can have multiple Pricebookentries for the same Product2. Example Pricebook2: MyCustomPricebook Product2: MySKU PricebookEntries MyCustomPricebookId MySKUId USD 10.00 ...
cropredy's user avatar
  • 71.8k
5 votes

Add a picklist value to Global Value Set in test class

How do I setup a new test value into the Global Value set and add the same into the ProductSelected__c picklist? You don't. You can't modify metadata of any type in a unit test. Also, we are not ...
sfdcfox's user avatar
  • 494k
4 votes
Accepted

Apex error - Pricebook error

The error states pretty well what is going on: you created an Opportunity with PB2 assigned to it You then attempted to insert an OLI with a pricebookentry of PB3 You cannot have line items from ...
Eric's user avatar
  • 54.2k
4 votes
Accepted

Can I add multiple currency prices to a product in one data upload?

You can do this in one Data Loader operation. One row per currency - list price - product2Id - pricebook2Id You probably will need to use an Excel operation to transform your source data which is ...
cropredy's user avatar
  • 71.8k
4 votes

How to use Test.getStandardPricebookId for classes that automaticaly sync quotes

Create a custom price book, set is as active (IsActive=true) and use it. If you are using a price book entry, then make sure standard entry is created before the custom one. This is because a standard ...
Subbu's user avatar
  • 41
4 votes
Accepted

FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (pricebook entry is inactive): [PricebookEntryId]

you have to make the pricebook entry Active In the part PricebookEntry pbe = new PricebookEntry(); pbe.Pricebook2Id=Test.getStandardPricebookId(); pbe.Product2Id=p1.id; pbe.UnitPrice=...
Kunal 's user avatar
  • 56
4 votes
Accepted

Standard vs Standard Price Book

The one without the "Is Standard Price Book" checkbox checked is actually a custom price book. I know that some templates come with this extra price book built in for whatever reason, but it bears no ...
sfdcfox's user avatar
  • 494k
4 votes

Salesforce CPQ: Contracted Pricing is Not Overriding Pricing Rule Price

There's a few options here depending on the business need (just replying with one solution for now): If the Contracted Price will always supersede the price rule(s): - Add a 'Price Condition': - ...
Rob's user avatar
  • 41
3 votes

FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (pricebook entry is inactive): [PricebookEntryId]

You need to set the IsActive flag to true on your Pricebook2, PricebookEntry, and Product2 records. The default value is to make these records inactive.
sfdcfox's user avatar
  • 494k
3 votes
Accepted

Is it possible to upsert PriceBookEntry

In order to upsert an sObject you'll need the objects Id or another external key field. Some options to achieve what you want: Create a external Id field and populate it with a unique combination of ...
Fernando Gavinho's user avatar
3 votes

Is it possible to upsert PriceBookEntry

In the Pricebookentry, Pricebook2Id and Product2Id are unique combination, so can't be modified. You can delete an entry and can add new entry
Santanu Boral's user avatar
3 votes
Accepted

Avoid exclusive access to the standard pricebook

Unfortunately, this is not really possible to work around. The best you can do today is place all tests referencing the Pricebook in a single class since tests in a class always run in serial (even if ...
dsharrison's user avatar
  • 3,992
3 votes
Accepted

Price book entry is in a different pricebook than the one assigned to the opportunity

You most likely have a Process Builder or a trigger, or wfr setting the price book on insert of the opportunity. You did debug and that is good but you only debugged what you created not the results ...
Eric's user avatar
  • 54.2k
3 votes

Junction object in Salesforce

Junction object is to achieve Many-to-Many relationship model in Salesforce. It means that each record can be associated with many records using the Junction object which keeps the reference of ...
Ashwani's user avatar
  • 22.6k
3 votes
Accepted

Price Book Record Types

That's not how Record Types work. Record Types do not restrict access to records, they merely stop users from creating records with those record types, or changing existing records to that record type ...
sfdcfox's user avatar
  • 494k
3 votes
Accepted

Problems using standard pricebook in unit tests

I bet you have enabled parallel test execution. A fast fix is to disable parallel test execution. If you want to look deeper, when you set Id of this PriceBook2 to some quote / order line items and ...
Oleksandr Berehovskyi's user avatar
3 votes

can i maintain 5 prices for a product with the same currency based on its volume?

A single product cannot have multiple prices in a pricebook. So, there are 2 options: Create duplicate products with unique product codes and define prices. You can create unit of measurement as ...
Santanu Boral's user avatar
3 votes

Test Classes failing due to default custom pricebook

You need to create the standard price book entry for the product, first, then create the price book entry for the custom price book. PricebookEntry[] pbe1 = new PricebookEntry[] { new ...
sfdcfox's user avatar
  • 494k
3 votes

How to query products from pricebook

Welcome to SF Stack Exchange! Since you are new I would like to point out two things about the query you've asked about. This might appear confusing to you but the API Name for Product is Product2(...
Arthlete's user avatar
  • 4,907
3 votes

How can you import a standard price book catalog in a scratch org with the data import command?

You can actually use a different tool to accomplish your goals: force:bulk:data:upsert. Create a CSV file that contains, at minimum, the following fields: Product2.Name, Pricebook2.Name, IsActive, and ...
sfdcfox's user avatar
  • 494k
2 votes
Accepted

Junction object in Salesforce

I disagree with the "common knowledge" on this issue. I have run into use-cases where using a Lookup relationship instead is appropriate. The junction object is a more flexible concept than people ...
Adrian Larson's user avatar
  • 150k
2 votes
Accepted

Is that possible to see the list of Price Book Entries?

This can also be done using the Price Books Tab as shown below
cropredy's user avatar
  • 71.8k
2 votes

Is that possible to see the list of Price Book Entries?

This can be accomplished using an OOB report type: Price Books with Products As you can see below, the available fields are the junction record: "Price Information" (the PBE) and the two parents: "...
cropredy's user avatar
  • 71.8k
2 votes
Accepted

How do I add prices to Products report?

Some reports were hidden - See below image to resolve. Tick "Select Report Types to Hide" - If there is an X next to the report it is hidden, click it to show and then have access to the report.
Paul Rogers's user avatar
2 votes

Why don't I see the Pricebook2Id field as available in formula field on PricebookEntry?

You can use Pricebook2.Id in your formula field on pricebookentry to return the related pricebook id.
Vamsi Krishna Gosu's user avatar
2 votes
Accepted

Add multiple new produtcs to Org pricebooks

you are not re-initialising the elements you are adding to the collection. move this line inside the for loop and it should resolve the error PricebookEntry notStandardPBE = new PricebookEntry();
Vamsi Krishna Gosu's user avatar
2 votes

How to filter the products that can be added to an Order?

Orders can be implemented in a number of different ways. Some orgs will use Opportunity to create a Contract and then create Orders against the Contract. One can associate a Price Book with a Contract ...
crmprogdev's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible