Symptom
- Adding a simple product via the Quick Add/Add Item search bar to a quote results in a generic error and the item is not added.
- Developer Console shows a fatal error: "System.Data.ConstraintException: Column 'DIRECTORY_CD' is constrained to be unique. Value 'XXXX' is already present."
Environment
SAP CPQ
Reproducing the Issue
- Open any existing or new quote in CPQ.
- In the Product section, use the Quick Add/Add Item search bar to find a product.
- Click Add to add the product to the quote.
- Observe that a generic error is displayed and the product is not added.
- Check developer/logs and note a fatal error with a unique constraint exception for 'DIRECTORY_CD'.
Cause
- A category in the product’s category hierarchy is set as its own parent (a loop in the ancestry), which leads to a unique constraint failure when resolving categories during Add to Quote.
- This issue occurs due to improper validation when using Product Integration API, which allows the definition of category as its own parent.
Resolution
- Identify the full category ancestry for an affected product (the product’s category and all of its parent categories up to the root)
- Locate any category that is defined as its own parent within that ancestry chain
- Correct the category hierarchy so no category references itself as its parent (remove the self-parent relationship and set the proper parent or make it a root as appropriate)
- Save the changes and ensure the corrected hierarchy is synchronized if using Product Integration API.
- Retest adding the product via Quick Add/Add Item to confirm the error no longer occurs.
- Review and adjust the Product Integration API process to add validation preventing self-parent category relationships from being created in the future.
Permanent fix date is yet to be announced.
See Also
Keywords
quick add, add item, add to quote error, generic error, directory_cd unique constraint, constraintexception, category hierarchy, self-parent, category loop, product integration api, application error, cartcontroller, cpq add item error, fatal error, sap cpq , KBA , CEC-SAL-CPQ , Sales Cloud CPQ , Known Error
Product
SAP CPQ all versions
SAP Knowledge Base Article - Public