Find your content:

Search form

You are here

Deleting PriceBookEntry results in errors

 
Share

I'm trying to use the Data Loader to delete PriceBookEntry records. However, I end up getting an error for all of them. The weird thing is that the Error message is the same as the contents of the Name field of the records.

I know Salesforce says that PriceBookEntry cannot be deleted (see the isActive field description), but the option is certainly there in Data Loader. Moreover, the error message is very odd and I was wondering how I should proceed. Any advice on this would be appreciated.


Attribution to: Dezzie

Possible Suggestion/Solution #1

According to your own reference you cited for the IsActive field:

Indicates whether this object is active (true) or not (false). Although you can never delete PricebookEntry records, your client application can set this flag to false. Inactive PricebookEntry objects are hidden in many areas in the user interface. You can change this flag on a PricebookEntry record as often as necessary.

Although the object reference does include an IsDeleted field, from the above, I'd conclude that once a field has been used in the PriceBook, it likely can't be deleted and would need to have it's IsActive flag set to "false". I strongly suspect that's because of Opportunity history but would have to check with an associate who would know more about it than I to be able to say with certainty.


Attribution to: crmprogdev

Possible Suggestion/Solution #2

Pricebookentries (PBE) can definitely be deleted by DataLoader or Excel Connector - I do it all the time.

If you try and delete the pricebookEntry on the standard pricebook when there are custom pricebooks using that same product (and hence custom PBE), you will get the error 'Delete Failed' with a reference to the product name. If you first delete PBE from the custom pricebook, then no error.

I can't speak for the documentation and would say it is wrong (or needs more elaboration). You can see at the bottom of the page, the following sentence:

If you delete a PricebookEntry while a line item references it, the line item is unaffected, but the PricebookEntry will be archived and unavailable from the API.

In addition, the object supports the delete() API operation.


Attribution to: cropredy
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/33340

My Block Status

My Block Content