Welcome to Zuora Product Documentation

Explore our rich library of product information

SelectBillingAccount component

The SelectBillingAccount component enables users to select or create Zuora billing accounts when generating quotes, offering customizable options and integration with Zuora Quotes.

The SelectBillingAccount component allows you to select an existing Zuora billing account or create a new billing account when creating quotes. The component supports the following:

  • Has customizable page name and description.

  • Allows user to choose a new billing account vs. an existing billing account.

  • When the existing billing account option is chosen, allows the user to choose an existing billing account, and displays the billing account details in a table.

  • Allows user to choose a Quote Type: New Subscription, Amendment, Renewal, and Cancellation.

  • When amending, renewing, or cancelling, allows user to choose a subscription.

  • When amending, renewing, or cancelling, all the subscriptions and subscription products for the account are listed.

  • Contains the Next and Cancel buttons. The target URL or an action for both buttons is configurable.

Based on the Get Billing Accounts from 360 Quote Configuration Setting in the Zuora Config tab, the following limits apply to the number of billing accounts listed by the SelectBillingAccount component:

  • If the setting is selected, up to 5000 billing accounts can be listed.

  • If the setting is not selected, up to 2000 billing accounts can be listed.

Note:

The SelectBillingAccount component is available in the Versions 5.100 and later of Zuora Quotes.

SelectBillingAccount Component Attributes

The following attributes are supported for the SelectBillingAccount component.

Attribute

Type

Required

Default Value

Description

amendQuotePage

String

No

Page.ZQAmendment

The quote create page for amendment quote.

backButtonLabel

String

No

Label. QUOTE_WIZARD_DEFAULT_BACK

The label text on the Back button.

The value is automatically determined from the quote wizard configuration if left unspecified and used within the valid quote wizard context.

cancelQuotePage

String

No

Page.ZQCancellation

The quote create page for cancelation quote.

crmAccountId

ID

Yes

N/A

CRM Account Id used to create quotes

disableBackButton

Boolean

No

False

Indicates whether or not to disable the Back button of the component.

The value is automatically determined from the quote wizard configuration if left unspecified and used within the valid quote wizard context.

existingQuoteId

ID

N/A

If the quote already exists, use this attribute to set the Id.

goBackPage

String

No

None

The component redirects to this URL if the Back button is clicked.

newQuotePage

String

No

Page.ZQQuoteEdit

The quote creation page for new subscription quotes.

User will be directed to this page upon clicking Continue .

nextButtonLabel

String

No

Label.Next

Text value rendered in the Next button.

opportunityId

ID

Yes

N/A

The opportunity that the quote will link with.

The account linked with this opportunity must have a Zuora billing account linked by CRM ID.

renderBackButton

Boolean

No

False

Indicates whether or not to render the Back button of the component.

The value is automatically determined from the quote wizard configuration if left unspecified and used within the valid quote wizard context.

renewalQuotePage

String

No

Page.ZQRenewal

The quote create page for renewal quote.

subTitle

String

No

N/A

The sub title of this component

title

String

No

N/A

Page title that will be displayed in the component

Component Plugin

Use the ICustomizeBillingAccountPlugin on the SelectBillingAccount component to customize the Select Billing Account process. The following customizations are available:

  • For billing account selection

    • Set the default billing account type to New or Existing

    • Filter billing accounts

    • Set the default billing account

  • For quote type selection

    • Set the default quote type

    • Control whether users can change the default quote type

    • Set the default subscription being amended, renewed, or canceled

The plugin interface is defined as:

global zqu.SelectBillingAccountComponentOptions.ICustomizeBillingAccountPlugin

The plugin contains the following interface methods.

Return Type

Method

Input Parameters

zqu.JsRemoteController.BillingAccountObjects

getAvailableBillingAccounts

zqu.JsRemoteController. BillingAccountObjects

zqu.JsRemoteController.QuoteTypeObjects

getAvailableQuoteTypes

zqu.JsRemoteController. QuoteTypeObjects

zqu.JsRemoteController.SubscriptionObjects

getAvailableSubscriptions

zqu.JsRemoteController. SubscriptionObjects

Sample Code

The following is a code sample of the SelectBillingAccount component and a code sample for the Billing Account Plugin.

<c:SelectBillingAccount title="New Quote" subTitle="Select Billing Account" 
   opportunityId="{!$CurrentPage.parameters.Id}" 
   newQuotePage="/apex/testNewQuote" 
   amendQuotePage="/apex/testNewAmend" 
   renewalQuotePage="/apex/testNewRenewal">

Sample Code for Customizing Billing Account Plugin

global class SampleSelectBillingAccountPlugin implements
    zqu.SelectBillingAccountComponentOptions.ICustomizeBillingAccountPlugin {
    global zqu.JSRemoteController.BillingAccountObjects
        getAvailableBillingAccounts(
            zqu.JSRemoteController.BillingAccountObjects accountObjs){
        //'accountObjs.billingAccountTypes' contains
        // a list of billing account types : 'new', 'existing'
        // Remove the 'new' account type
        // to disallow new account creation
        if(accountObjs.opportunityId == '001o000000VNv02AAD'){
            accountObjs.billingAccountTypes.remove(0);
        }
        // Set the default selected billing account type
        accountObjs.defaultBillingAccountType = 'existing';
        // 'accountObjs.billingAccounts.dataObjects' contains
        // a list of billing account objects : List<Map<String, Object>>
        // Use this attribute to filter the billing accounts
        // Remove the first one
        accountObjs.billingAccounts.dataObjects.remove(0);
        // Set the default selected billing account
        accountObjs.defaultBillingAccountId = '2c92c0f94e001371014e00b527bf17a4';
        return accountObjs;
    }
    global zqu.JSRemoteController.QuoteTypeObjects
        getAvailableQuoteTypes(
            zqu.JSRemoteController.QuoteTypeObjects quoteTypeObjs){
        // 'quoteTypeObjs.quoteTypes' contains a list of all quote types:
        // 'new', 'amend', 'renew', 'cancel'
        // Remove the 'new' quote type to disallow
        // New Subscription quote being created
        if( quoteTypeObjs.billingAccountId ==
            '2c92c0f94e001371014e00b527bf17a4'){
            quoteTypeObjs.quoteTypes.remove(0);
        }
        // Set the default quote type to 'renew'
        quoteTypeObjs.defaultQuoteType = 'renew';
        return quoteTypeObjs;
    }
    global zqu.JSRemoteController.SubscriptionObjects
        getAvailableSubscriptions(
            zqu.JSRemoteController.SubscriptionObjects subscriptionObjs){
        // 'subscriptionObjs.subscriptions.dataObjects' contains
        // a list of subscription objects : List<Map<String, Object>>
        // Use this attribute to filter the subcriptions
        // Remove the last one
        subscriptionObjs.subscriptions.dataObjects.remove(
        subscriptionObjs.subscriptions.dataObjects.size() - 1);
        // Set the default subscription based on billing account
        if( subscriptionObjs.billingAccountId ==
            '2c92c0f94e001371014e00b527bf17a4'){
            subscriptionObjs.defaultSubscriptionId =
              '2c92c0f84e2efd45014e3e121c6e1a0b';
        }
        // Set the default subscription based on the quote type
        if (subscriptionObjs.selectedSubscriptionType == 'renew') {
            subscriptionObjs.defaultSubscriptionId =
                '2c92c0f84e2efd45014e3e121c6e1a0c';
        }
        return subscriptionObjs;
    }
}

Test Class for Billing Account Plugin

The following is a APEX test class code sample for Billing Account Plugin. You can use the test class to achieve code coverage on the plugin in Salesforce.

@isTest
public class SampleSelectBillingAccountPluginTest {
    @isTest
    static void testAvailableBillingAccounts() {
        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.JSRemoteController.ListData listData = new zqu.JSRemoteController.ListData();
        listData.dataObjects = new List<Map<String, Object>>();
        Map<String,Object> maptest = new Map<String,Object>();
        maptest.put('Account',acc);
        listData.dataObjects.add(maptest);
        zqu.JsRemoteController.BillingAccountObjects accountObjects = new zqu.JsRemoteController.BillingAccountObjects();
        accountObjects.billingAccounts = listData;
        accountObjects.opportunityId = '001o000000VNv02AAD';
        accountObjects.billingAccountTypes = new List<String>{'amend','renew'};
        accountObjects.sfdcAccountId = acc.Id;
        SampleSelectBillingAccountPlugin selectBAPlugin = new SampleSelectBillingAccountPlugin();
        selectBAPlugin.getAvailableBillingAccounts(accountObjects);
    }
    @isTest
    static void testAvailableQuoteTypes() {
        Account acc = new Account(name='Test Account');
        insert acc;
        zqu.JsRemoteController.QuoteTypeObjects quoteTypeObjs = new zqu.JsRemoteController.QuoteTypeObjects();
        quoteTypeObjs.sfdcAccountId = acc.Id;
        quoteTypeObjs.billingAccountId = '2c92c0f94e001371014e00b527bf17a4';
        quoteTypeObjs.quoteTypes = new List<String>{'amend','renew'};
        SampleSelectBillingAccountPlugin selectBAPlugin = new SampleSelectBillingAccountPlugin();
        selectBAPlugin.getAvailableQuoteTypes(quoteTypeObjs);
    }
    @isTest
    static void testAvailableSubscriptions() {
        Account acc = new Account(name='Test Account');
        insert acc;
        zqu.JSRemoteController.ListData listData = new zqu.JSRemoteController.ListData();
        listData.dataObjects = new List<Map<String, Object>>();
        Map<String,Object> maptest = new Map<String,Object>();
        maptest.put(String.valueOf(acc.Id),acc);
        listData.dataObjects.add(maptest);
        zqu.JsRemoteController.SubscriptionObjects subObjs = new zqu.JsRemoteController.SubscriptionObjects();
        subObjs.sfdcAccountId = acc.Id;
        subObjs.selectedSubscriptionType = 'renew';
        subObjs.billingAccountId = '2c92c0f94e001371014e00b527bf17a4';
        subObjs.subscriptions = listData;
        SampleSelectBillingAccountPlugin selectBAPlugin = new SampleSelectBillingAccountPlugin();
        selectBAPlugin.getAvailableSubscriptions(subObjs);
    }
}