"Error: Invalid Data" on Product Clone or Create
|Knowledge Article Number||000199313|
|Description||With the Summer '14 Release, the functionality behind cloning and creating Products remains the same. However, there is now a commit that occurs both when the Product is created and when the Price Book Entry (PBE) is created. This was aligned to be consistent with the way our system clones other objects with child objects (e.g., Opportunity with Products, Order with Products, etc).
If your organization has a custom Apex trigger that inserts a Price Book Entry, you may encounter an error during the clone/create attempt:
ERROR: Error: Invalid Data. Review all error messages below to correct your data. common.exception.SfdcSqlException
This means that prior to Summer '14, the Product trigger in question was developed to fire after Price Book Entry was created. Now the trigger fires after Product creation and before PBE creation (i.e., before the clone process is finished). When the clone process tries to complete and insert the PBEs, it is getting a unique constraint error because the trigger has already inserted PBEs. The database can't allow 2 PBEs with the same currency in the same Price Book for the same Product - therefore, an error is thrown.
|Resolution||The system is working as designed. The only way to resolve this issue is by revising the custom Apex trigger to either not create the Price Book Entry or, alternatively, to update the PBE that is automatically created during the standard Product Clone process.|