Welcome to Zuora Product Documentation

Explore our rich library of product information

Implement a guided selling flow plugin

This task guides you through creating a custom Guided Selling Flow Plugin for the SelectProduct component, displaying flows based on quote types.

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.

  1. 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.
  2. 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"..
@isTest
public class GuidedSellingFlowPluginImplTest {
@isTest
    static void testGetFlows() {
        Account acc = new Account(name='Test Account');
        insert acc;
        Contact billTo = new Contact(FirstName = 'BillToFName', LastName =
'BillToLName');
        billTo.accountId = acc.Id;
        Contact soldTo = new Contact(FirstName = 'SoldToFName', LastName =
'SoldToLName');
        soldTo.accountId = acc.Id;
        Contact[] contacts = new List<Contact>{ billTo, soldTo };
        insert contacts;
        zqu__Quote__c quote = new zqu__Quote__c();
        quote.Name = 'test quote';
        quote.zqu__Account__c = acc.Id;
        quote.zqu__SubscriptionType__c = 'New Subscription';
        insert quote;
        zqu__GuidedSellingFlow__c flow = new zqu__GuidedSellingFlow__c();
        flow.Name = 'New Flow';
        flow.zqu__IncludeInProductSelector__c = true;
        insert flow;
        GuidedSellingFlowPluginImpl gsfp = new GuidedSellingFlowPluginImpl();
        gsfp.getFlows(quote.Id);
    }
}

Test Class for Guided Selling Flow Plugin

The following is a APEX test class code sample for Guided Selling Flow Plugin. You can use the test class to achieve code coverage on the plugin in Salesforce.
@isTest
public class GuidedSellingFlowPluginImplTest {
@isTest
    static void testGetFlows() {
        Account acc = new Account(name='Test Account');
        insert acc;
        Contact billTo = new Contact(FirstName = 'BillToFName', LastName =
'BillToLName');
        billTo.accountId = acc.Id;
        Contact soldTo = new Contact(FirstName = 'SoldToFName', LastName =
'SoldToLName');
        soldTo.accountId = acc.Id;
        Contact[] contacts = new List<Contact>{ billTo, soldTo };
        insert contacts;
        zqu__Quote__c quote = new zqu__Quote__c();
        quote.Name = 'test quote';
        quote.zqu__Account__c = acc.Id;
        quote.zqu__SubscriptionType__c = 'New Subscription';
        insert quote;
        zqu__GuidedSellingFlow__c flow = new zqu__GuidedSellingFlow__c();
        flow.Name = 'New Flow';
        flow.zqu__IncludeInProductSelector__c = true;
        insert flow;
        GuidedSellingFlowPluginImpl gsfp = new GuidedSellingFlowPluginImpl();
        gsfp.getFlows(quote.Id);
    }
}