"Value Not of Required Type" Appears When Refresh Prices and QCP is Used
Trailblazer Community

"Value Not of Required Type" Appears When Refresh Prices and QCP is Used

Salesforce CPQ (Configure-Price-Quote)

Last updated 2020-02-13 ·Reference W-5244130 ·Reported By 0 users

No Fix

"Value Not of Required Type" Appears when Refresh Prices is clicked and the plugin has QCP where QCP script has the following:
1. Field type = checkbox
2. Checkbox field is added to the Quote Fields in Custom Script
3. Checkbox field is only used as a reference in QCP and is no value is being written to it.

1. Navigate to Custom Script > New. Populate the following fields:
Script Name = give it any name (i.e CustomScript)
Code = paste the sample code below:
export function onBeforeCalculate(quote, quoteLines) {
var test = quote.record['Checkbox_Field_API_Name']; //checkbox field is only referenced and no value is written back.
return Promise.resolve();
Quote Fields = add the Checkbox_Field_API_Name
2. Save.
3. Navigate to apex/editSettings -> Plugins or Setup > Installed Packages > [Configure] Salesforce CPQ > Plugins.
4. In Quote Calculator Plugin, paste the name of the custom script you just created in step 5 (i.e CustomScript) then Save.
5. Open any quote with quote lines.
6. Click on any associate product for a quote line that has Pricing Method = List.
7. Modify the pricebook entry price for the product
8. Navigate back to your quote > click Refresh Prices > Refresh Price. Error appears.

Create a 'ReferencedFields' field set in the Quote object if you do not have it. Add the checkbox field in the field set.

For more information, see

Reported By (0)

Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.