Hot answers tagged

7

There is no direct binding to the Product table from Order Lines, the link is actually through PricebookEntries. So the SOQL to get the ProductId would be: select Pricebookentry.Product2Id from OrderItem


7

I've reproduced the problem with setting the OpportunityLineItem.Quantity to zero. As you would expect, there is a field integrity exception: Quantity (quantity must be nonzero) message added to the page automatically. I also got the unexpected Dwarf details added to the page messages. It appears the additional validation message is coming from the ...


5

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 PricebookEntry(Pricebook2Id = test.getStandardPricebookId(), Product2Id = prd1, UnitPrice = 1000); insert standardPBE; Additionally, although not related, if ...


5

You can't remove the field, nor can you really do anything else to it. However, if Product Name is unimportant, I'd suggest the following setup. First, go to Setup > Customize > Tab Names and Labels > Rename Tabs and Labels, edit Product, and on the second screen, overwrite the Product Name field with the values Product Code and Product Codes, for the ...


5

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 FROM PricebookEntry WHERE Pricebook2Id = '01si0000003vpAlAAI') My first stop with this kind of issue is always the field ...


5

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 pencils; each package has a SKU or UPC that would be considered a Product Code. Such a product can be active or not (can be sold or not). Price Book (Pricebook2) ...


5

You should check if the field is accessible before adding it to your query. for (SObjectField field : SObjectType.Product2.fields.getMap().values()) { if (field.getDescribe().isAccessible()) { // now you can include it in your query } }


4

The OLI.Product2Id field is instantiated when the OLI is inserted for a given PricebookEntry. The value inserted is the value from Pricebookentry.product2Id As such, to fix this issue, you will need to delete the existing OLI for any of the duplicate (bad) Product2Id and reinsert the OLI using the correct PriceBookEntry (and hence its corresponding ...


4

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 archived. (* I'm referring to the Activate and Deactivate links on the product's list view; simply changing the status using inline edit/normal edit still fires ...


4

By default, the Product Code field isn't unique. As it states here, it's purpose is: The internal code or product number that you use to identify the product. However, it is possible to make it unique, kinda. There's a discussion about this here. The take aways from this is to "de-duplicate" either by: An app called DupeCatcher A Trigger A bit of a ...


4

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 special significance. It can be deleted like any custom price book, unlike the standard price book, which may never be deleted (though it can be deactivated).


4

It sounds like you've got a mix of API versions in your classes and/or triggers, and this is causing a problem. If you use a utility class to generate your dynamic queries, please make sure the API version is no higher than all other classes that use this utility class. This can cause new fields/objects to be exposed to older versions and cause runtime ...


3

Product2Id is a read-only field available in API version 30.0 and later for OpportunityLineItem. Use the PricebookEntryId field instead, specifying the ID of the PricebookEntry record. Check this : https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_opportunitylineitem.htm


3

Yes you can create package without being a partner because only developer account is required to create a package but if you want to publish that on app exchange you need a partner account. No, Partner exchange program is completely free for any user. You can't publish app without being partner. Free apps are free to list, but for paid apps you have to pay $...


3

You can use SOQL and VLookup to get your answer. Go to workbench.developerforce.com and login to salesforce production environment. For the "Jump To" field select SOQL. For the object choose Pricebook Entry. In the "Enter or modify a SOQL query below:" field enter the following: SELECT Id,IsActive,IsDeleted,Name,Pricebook2Id,Product2Id,ProductCode,...


3

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

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 fields (example: Product2Id + Pricebook2Id) and use that field on your upsert call upsert lstp New_External_Field__c Query for Pricebook entry and retrieve the ...


3

Creating new products and (eventually) deactivating the old ones is most likely the way to go. Keep in mind that when you change a record, you change the appearance of that record everywhere that you reference it. This is also why salesforce.com recommends that you deactivate a user and create a new one, instead of altering an old user record to a new person....


3

As far as I can tell, you need to be using API v.39 or higher to access this field. This seems to be part of a new feature, as it doesn't appear in most of the documentation yet. It is mentioned here, but that's about it.


3

There was a critical update on October 5th, 2018 to address a security vulnerability related to unauthenticated guest users. This critical update proactively limited the default permissions given to unauthenticated guest users, so if you have functionality in a Salesforce Site or Community that relied on the previously broader permissions, you will be ...


3

Follow given steps : Go to the Price Book Entry object Select Search Layouts Edit Search Results Change the fields Press Save


2

Edit Update: Updated the answer as per Vamsi's suggestion in the comments i.e. no need of a controller and can be achieved via VF page. Create a new VF Page: <apex:page action="{!URLFOR($Action.Product2.List, $ObjectType.Product2)}"/> Go to Customize->Products->Buttons and Links Edit the "Products Tab" Under the Override Properties section, for "...


2

I'm assuming you mean Product records as I know of no way for someone to create a new sObject from a Community. If you did mean records, because of the permissions required, the only way one could do this would be to create a "mirror" object and use triggers to pass record inserts and updates back and forth between the Partner Community and your Org. This ...


2

In your code, I dont see you are inserting PricebookEntry. before product2Id we need to have this value. I guess this question will help you on how we can insert Orderitem.


2

You should create the custom button under Opportuniy -> Opportunity Product and not directly under Products.


2

I put your code into my sandbox and I got the following error: Required fields are missing: [Product Name] So you are missing the name not the product code Adding the following and it works correctly: <apex:inputField value="{!prod.Name}" required="true"/>


2

Yes custom picklist field is the option.


2

Product2Id was added as a read-only lookup field to OpportunityLineItem in API v30.0 If your trigger is using a version of the API prior to v30.0, you'll need to go through PricebookEntry to get to Product2 on an OpportunityLineItem, or update the trigger's metadata to use API v30.0 or newer. If you don't want to (or otherwise can't) update the API version ...


2

According to the "Help & Training" documentation (located here), the behavior is supposed to be as follows: The Clone button on a product quickly creates a new product with the same information as the existing product. Cloning products also creates any price book entries in price books that you can view. Price book entries in price books that ...


2

First, to clone a pricebook entry, one needs to have the “Create” on price books permission enabled. So it's unlikely that you'd not have access to the Standard Pricebook if you have that permission on your profile. If a product already exists in the Standard Pricebook, then you'd be safe in cloning it to a Custom Pricebook provided you didn't make any ...


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