Steelbrick CPQ API validate quote not working as expected

I’m creating a quote via the native CPQ quote line editor and adding a bundle with its corresponding options for the each feature.

After creating the quote I want to validate it via the API using the ConfigurationValidator service doing something like this:

private static Id STANDARD_PB = '01s0Y0000077iqW';

public static void validate(Id productBundle, Id quoteId) {

    Map<String, Object> prodContext = new Map<String, Object>();
    prodContext.put('currencyCode', 'EUR');
    prodContext.put('pricebookId', STANDARD_PB);

    String pJson = SBQQ.ServiceRouter.load('ProductAPI.ProductLoader', productBundle, JSON.serialize(prodContext));
    Map<String, Object> pModel = (Map<String, Object>)JSON.deserializeUntyped(pJson);

    String qmodelJson ='SBQQ.QuoteAPI.QuoteReader', quoteId);

    Map<String, Object> deserial = (Map<String, Object>)JSON.deserializeUntyped(qmodelJson);

    Map<String, Object> validContext = new Map<String, Object>();
    validContext.put('quote', deserial);
    validContext.put('configuration', pModel.get('configuration'));
    validContext.put('event', 'Edit');

    return SBQQ.ServiceRouter.load('ConfigAPI.ConfigurationValidator', '', JSON.serialize(validContext));

In the resulting JSON I expect the validationMessages key to be an empty array; however it has an error of type:

Too few options selected for <feature>

Indicating that a product option was not selected for a specific feature (<feature>); however a quote line containing the product option is there since I created via the UI.

How should I implement validation of a quote, or a single bundle’s configuration in quote?


Source : Link , Question Author : jonathanwiesel , Answer Author : Community

Leave a Comment