function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rachel Linder 20Rachel Linder 20 

Can you have a Case Automatically Created Based on a CPQ Product Rule Validation Error Message within the Quote Line Editor?

We have several CPQ product rules that are validation rules. When in the Quote Line Editor we have a rep that adds a product. When clicking Save the product rule will fire the red validation error message at the top of the page.

Is there a way that you can automate the creation of a case when that error message appears?
ShirishaShirisha (Salesforce Developers) 
Hi Rachel,

Greetings!

Validation rule is used to restrict the record creation when the user doesn't provide all the required information.I don't think if there is any way other than inactivating the validation rule here.

However,you can de-activate the validation rule and instead of using the validation rule you can use the popup,if the required field is missing and once they click on Ok/Cancel then insert the record.

This can be done by using the Visualforce page or lightning component.

Sample code for popup on VF page:
http://www.salesforcegeneral.com/salesforce-modal-dialog-box/

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
Andrew GAndrew G

Hi Rachel

Since the Product Rule operates within the CPQ Quote Editor, and operates purely to stop the saving of the quote unless it matches the condition required by the validation rule.  For example:"Toner quantity must be greater than or equal to printer quantity."  The error remains associated with the Product Line and prevents the saving of the quote until rectified.  And disabling it to go to a VF page popup within the confines of the Quote  Editor may not be feasible due to the fact that it exists within the managed package of CPQ.

Now, the question becomes why are you trying to create a case due to a Product Rule Validation error?

Guessing - I suspect you are trying to track how often a Product Rule is invoked.  From the Product Rule, there is no way that i'm aware of to track the validation has fired.

Now, depending exactly on what you are trying to achieve, I wonder if we consider a Price Rule.  You could do a Price Rule that updates the Product Line Item with a value that is hidden from layouts etc.  You could then fire a process using this field to create the Case. However, depending on what you are trying to achieve, you could end up duplicating work in both the Product Rule and the Price Rule.  And if you are purely trying to see how many times the validation fired, perhaps you could simply do a report based on the Product Line Item with that field value set.

I have used Price Rules to update Product Line Items hidden fields, but unsure how it would work trying to replicate the validation requirements of the Product Rule.

I hope the above proves helpful.

Regards
Andrew