9
votes
Get custom Picklist value in LWC without Record Type
Use the "null" record type Id, "012000000000000AAA" as the record type Id.
@wire(getPicklistValues, { objectApiName: PRICEBOOK_OBJECT, recordTypeId: '012000000000000AAA'})
This is ...
8
votes
Accepted
In which sequence should I be creating/inserting order/orderItem/pricebookEntry/product2?
It's helpful to understand the various concepts directly.
Product (Product2)
Represents a product. A product is something that can be sold. For example, you walk in to a store and see packages of ...
6
votes
Accepted
Add a lookup to Price Book Entry on a Custom Object
Unfortunately this is not possible.Idea has already been raised earlier.Please check the below link
https://success.salesforce.com/ideaView?id=08730000000ZimNAAS
I have never tried this on before ...
5
votes
Accepted
Error:-PricebookEntryId (pricebook entry is in a different pricebook than the one assigned to the opportunity): [PricebookEntryId]
Like I said in comment your Opportunity.Pricebook2Id should be equal to your OLI.pricebookEntry.Pricebook2Id
So for solution what you can do..
Query only those PricebookEntry where pricebookEntry....
5
votes
Accepted
Can I show the standard price on the product layout page?
As a matter of fact, there is a way to do this, although not in the "usual" manner (i.e. adding a field). Instead, you can write a Visualforce page for this:
StandardPriceDisplay.vfp (Label: Standard ...
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
...
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
...
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 ...
4
votes
Accepted
Is there any hook/event when a product is archived?
No, there are no database events triggered for activation*, deactivation*, and archive events. In fact, there doesn't even appear to be a field that allows you to determine if a product has been ...
4
votes
Accepted
Unable to add PriceBookEntry with APEX
I believe you are receiving the error as you are trying to assign an ID to object placeholder.
Please try using Product2Id = productId instead of Product2 in your code.
Reference
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 ...
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 ...
4
votes
Accepted
Visualforce Lookup field not allowing entry for certain profiles
The field accessibility will show access to the fields assuming they profile has access to the object.
Ensure the profile has edit or create access to the PriceBook object and at least read on the ...
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 ...
3
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=...
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.
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 ...
3
votes
Accepted
Pricebook entry currency code does not match opportunity currency code
Try setting the CurrencyIsoCode on the PricebookEntry before insert.
thePricebookEntry.CurrencyIsoCode = this.theOpportunity.CurrencyIsoCode;
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 ...
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
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 ...
3
votes
Accepted
FIELD_INTEGRITY_EXCEPTION, This price definition already exists in this price book
You have a number of problems in this code. Most of this stems from the fact that you're querying every price book entry in the database, instead of the ones you're interested in copying:
global ...
2
votes
Accepted
Not able to add Products to Price book entries
I tried the code in Developer console and its working fine. The error might be because of below reason
If there is any apex class with the same name of the standard or global sObjects while creating ...
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
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: "...
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.
2
votes
Accepted
Process builder Create Product and Pricebook Entry at the same time
You can't do this purely in Process Builder. Instead, you'll need to use either an auto-launched flow, an Apex invocation, or consider just writing a trigger directly. Keep in mind that using a flow ...
2
votes
Accepted
SOQL Query on PricebookEntry returning no rows
Because of Database Isolation, your test code can't see real price books or price book entries. Make sure you create all the data you need:
Product2 productRecord = new Product2(Name='Test',IsActive=...
2
votes
Accepted
Different currencies in PricebookEntry throwing exception FIELD_INTEGRITY_EXCEPTION, PricebookEntryId (must have the same currency as the order)
I don't see you setting the currency of your new orders.
Try adding
orderNew.CurrencyIsoCode = qu.CurrencyIsoCode;
after instantiation of a new Order object.
The complaint is simply, that the used ...
2
votes
Load PricebookEntry in empty Scratchorg with Cumulusci
Whitespace and indentation are significant in YAML. This mapping file isn't valid and would result in CumulusCI missing information and misunderstanding your intent.
A correctly-formatted version of ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
pricebookentry × 94pricebook × 47
apex × 29
product × 17
opportunity-lineitem × 16
soql × 9
trigger × 8
orderitem × 7
opportunity × 6
order × 5
quotelineitem × 4
visualforce × 3
error × 3
upsert × 3
currency × 3
lightning × 2
lightning-web-components × 2
unit-test × 2
salesforcedx × 2
visual-workflow × 2
process-builder × 2
query × 2
quote × 2
csv × 2
dmlexception × 2