Option Filter Callback provides you with a mechanism to control the visibility of the option products on the Configuration page based on the custom logic that you define. The callback is executed in the following scenarios:

  • when you click Configure on the Catalog page
  • when the configuration of the product is pending and you click the wrench icon ( ) on the Cart page. 

When callback is invoked, CPQ excludes the option products on the Configuration page.

Default options and options included based on constraint rules are also hidden when the Option Filter Callback is used to hide options. In the scenario, where all the case all the options in an option group are hidden, the option group is also hidden on the Configuration page.

To use the Option Filter Callback you must create a custom Apex class that implements the Apttus_Config2.CustomClass.IOptionFilterCallback interface and register the custom apex class with Option Filter Callback Class. You must write your custom logic in the custom apex class.

The following methods are available in the Apttus_Config2.CustomClass.IOptionFilterCallback interface:

MethodSignatureDescription
getExcludedOptionIds()List getExcludedOptionIds(Apttus_Config2.CustomClass.ActionParams)You can use this method to define custom logic to hide options on the Configuration page.

Example

This is just a sample callback custom class to control the exclusion of option products on the catalog page. The following custom code only removes a few option products. You may change the custom class to list out the ID of option products to fit your business requirements.

using System.Collections.Generic;
using System.Threading.Tasks;
using Apttus.Lightsaber.Config.Common.Callback;
using Apttus.Lightsaber.Config.Common.Callback.Models;
using Apttus.Lightsaber.Extensibility.Library;

namespace NewOptionFilterCallback_ST
{
    /// <summary>
    /// Option Filter Callback
    /// </summary>
    public class OptionFilterCallback : CodeExtensibility, IOptionFilterCallback
    {
        /// <summary>
        /// Callback to return option IDs which are to be excluded from the bundle
        /// This filter is used when we configure a bundle.
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public async Task<List<string>> GetExcludedOptionIds(Apttus_Config2.CustomClass.ActionParams params)
        {
            var proposal = new Proposal(config.GetCart());
             //return new List<ID>{ <18 CHARACTER PRODUCT ID> };
            //Example for returning THREE products to be excluded:
            return new List<ID>{ '01t3C000000DVwh', '01t3C000000DVwm','01t3C000000DVww'};
            //Example for returning ONE product to be excluded:
            //  return new List<ID>{ 01t50000004nmL1YYX'};

        }
CODE