Skip to main content

Guided Selling Flow Plugin Example


Guided Selling Flow Plugin Example

This article describes the process of creating a sample custom Guided Selling Flow Plugin on the SelectProduct component. The sample plug-in displays the corresponding Guided Selling Flows based on the quote type, New Subscription or Amendment/Renewal.

Implement a Guided Selling Flow Plugin

To create a new plugin and register:

  1. Navigate to Zuora Config > Guided Product Selectors.
  2. Create Guided Selling Flows, New Service Flow and Amend Service Flow. Save the flows.
  3. Create a new class, GuidedSellingFlowPluginImpl, using the code below.
  4. Navigate to Zuora Config > Component Registration.
  5. Click Edit for the SelectProduct component.
  6. In the Component Plugins section, for the Guided Selling Flow Plugin type, specify GuidedSellingFlowPluginImpl in the Class Name field.
  7. Click Update.

To test the new plug-in:

  1. Create a quote for New Subscription.
  2. When you get to the Choose Product and Charges step, you see the Guided Selling Flows whose label starts with "New" as shown in the following image.
global class GuidedSellingFlowPluginImpl implements zqu.SelectProductComponentOptions.IGuidedSellingFlowPlugin{   
   public List<ID> getFlows(Id quoteId){
      List < Id > flowIds = new List < Id >();

      if(String.isBlank(quoteId)) return flowIds;

      // Retrieve the quote based on Id
      List < zqu__Quote__c > quoteList = [SELECT Name, zqu__SubscriptionType__c FROM zqu__Quote__c WHERE Id = :quoteId];
      if(quoteList.isEmpty()) return flowIds;
      // Determine the string to query flows based on the subscription type of the quote
      String flowName = quoteList[0].zqu__SubscriptionType__c == 'New Subscription' ? 'New %' : '%Amend%"';

      // Query for flows based on the name and IncludeInProductSelector flag
      List < zqu__GuidedSellingFlow__c > flows = [SELECT Id FROM zqu__GuidedSellingFlow__c WHERE zqu__IncludeInProductSelector__c = true AND (Name like :flowName)];
      if(flows.isEmpty()) return flowIds; 

      // If flows were found, add their ids to the result list
      for(zqu__GuidedSellingFlow__c flow : flows) {
      return flowIds;