Skip to main content

zQuoteUtil.getZuoraConfigInformation Method

Zuora

zQuoteUtil.getZuoraConfigInformation Method

The getZuoraConfigInformation method returns all fields and values in the Zuora Quotes configuration in a map that holds key-value pairs, field names as keys and field values as values. 

The return value of this method is a Map<String,Object>. You need to cast each value to the explicit types within Apex. See the Example Code section for examples.

It is safe to call this method multiple times in a single Apex request/transaction as it caches the Map and underlying describe call after the first execution for the life of the request.

For security reasons, the APIPassword__c field in the Zuora Quotes configuration is not returned by this method.

Supported Key Types

You can use the following types of keys to get the value of a specific field in Zuora Config.

Key Type Description
apiurl__c Text (200) Zuora API endpoint URL
apiusername__c Text (50) Zuora API Login User Name
apply_credit_balance__c Checkbox The flag determines whether any credit balance on a customer's account is automatically applied to invoices
approved_quote_Status__c Text (255) This is the final, approved status of the quote, signifying that it can be sent to Zuora.
allow_updating_zuora_account_info__c Checkbox Enable this to allow users to use Salesforce data to update Zuora billing account and contact data.
always_active_amendment__c Checkbox Enable this to auto fill trigger dates with the value of the previous trigger date (eg. Customer Acceptance Date populated from Service Activation Date). When sent to Z-Billing, amendments will then be set to active.
amendmenttemplateid__c Text (50) The template id configured in Zuora for Quote Amendment PDF generation
attachtoopportunity__c Checkbox If this is enabled, Zuora Quotes will immediately attach the Quote PDF or Word document to the Quote or Opportunity.  If this is disabled, you must view the Quote PDF or Word document and save it manually.
auto_replace_expired_rate_plans__c Checkbox If you create a renewal quote and a subscription contains a rate plan that is no longer active (the rate plan is past the expiration date set in the product catalog), enable this feature to have Zuora Quotes replace the expired rate plan automatically.
autofill_dates_for_preview__c Checkbox This setting will use the prior trigger date in the trigger date hierarchy in Quote Preview if that trigger date is null (e.g., will use the Contract Effective Date for the Service Activation Date if Service Activation Date is null).
billingaccount_allowInvoiceedit__c Checkbox Enable to allow Invoice Editing in Zuora when the Billing Account is created.
billingaccount_batch__c Text (50) Set the default value for the Batch field.
billingaccount_billcycleday__c Text (100) Set the default value for the Bill Cycle Day field.
calculate_quote_metrics_through__c Text (20) Select how you would like Quote Metrics values to be calculated.If you select the End of Term option, Evergreen Subscription metrics will be calculated for 1 billing period.
copy_quoterateplancharge_to_quotecharge__c Checkbox Copy data from Quote Rate Plan Charge to Quote Charge for New Subscription if this checkbox is checked.
currency__c Text (50) Set the default value for the Currency field.
default_subscription_term_type__c Text (50) Set the default value for the Subscription Term Type field.
disable_discounting__c Checkbox Enable to disallow users from providing additional price discounts in quotes.
display_progress_bar__c Checkbox Display the progress bar in the quote flow.
display_rules_engine_change_logs__c Checkbox Select to display rules engine change logs on Product Selector.
electronicpaymentmethodsetting__c Text (64) Determine how an Electronic Payment Method is treated when an Electronic Payment Method is created during the Quoting process.
enable_cpq__c Checkbox Enable Bundling, including Salesforce Product Catalog Sync to Zuora.
enable_feature__c Checkbox This will be automatically selected (at most after 24 hours) once you enable Features in the corresponding Zuora environment.
enable_force_recalculation__c Checkbox Select to enable force recalculation for all charges before saving on Product Selector.
enable_real_time_rule_calculation__c Checkbox Select to run rules whenever a field value is changed on Product Selector.
enable_guidedSelling__c Checkbox Select to enable the Guided Product Selector instead of the existing Product Selector.
enable_hpm_1__c Checkbox Enable Hosted Payment Method pages.
enable_hpm_2__c Checkbox Enable Payment Pages 2.0.
enable_invoice_owner__c Checkbox Enable specifying invoice owner on quotes.
enable_multi_entity__c Checkbox This will be automatically selected (at most after 24 hours) once you enable Multi-Entity in the corresponding Zuora environment.
enable_parent_customer_account__c Checkbox Enable specifying parent customer account while creating a new subscription quote with a new Billing Account.
enable_summary_reporting__c Checkbox Select to enable consolidated pipeline reporting on new subscriptions, amendments, and renewals at the Quote Charge level.
generate_invoice__c Checkbox Select to generate an invoice automatically when the subscription is created. The default is no (unchecked). To use this feature, you must configure Zuora to invoice subscriptions separately.
get_billing_account_from_360__c Checkbox This setting will obtain Billing Account information directly from Zuora 360 in Salesforce without querying Zuora. We recommend you have Real Time Sync turned on in order to use this setting to always have the most up-to-date Billing Account data.
get_contacts_for_parent_and_child__c Checkbox Get contacts for parent and child Salesforce Accounts to display on the Quote creation screens. If not selected it will only get the contacts of the Salesforce Account specified and not the parent or children.
get_tiers_from_zuora__c Checkbox This setting is relevant only for Amendment and Renewal Quotes. When checked, Quotes will obtain Subscription Rate Plan Charge Tiers directly from the Subscription in Zuora. Unchecked, Tiers will be from the Zuora Product Catalog in Salesforce 360.
hide_bill_to_and_sold_to_contacts__c Checkbox If checked, the Bill-to and Sold-to Contact fields will be hidden from the Amendment/Renewal Quote edit and preview pages.
hide_default_product_selector__c Checkbox Select to use a custom product selector.
invoice_delivery_preferences__c Text (50) Default Invoice Delivery Preference in Zuora Quotes
list_filter_max_level__c Number

Maximum level of relationship to go through:

  • 0 = 1-level depth
  • 1 = 2-level depth
  • 2 = 3-level depth
maximum_rate_plans_added_to_quote__c Number (3, 0) Maximum number of rate plans allowed to be added to quote in product selector.
notificationemailaddress__c Text (50) Failed callouts will send logs to this email address.
override_null_value__c Checkbox Select to override null values of custom field sent to Zuora.
payment_term__c Text (50) Set the default value for the Payment Term field.
prefix_quote_for_in_quote_name__c Checkbox Include Prefix in Quote Name.
process_payments__c Checkbox Select to apply a payment when the subscription is created. To use this feature, you must configure Zuora to invoice subscriptions separately.
quoteurl__c Text (200) Zuora Quote Generate PDF URL
quote_read_only__c Checkbox Enable to change quotes to the read-only status after they have been sent to Zuora. This removes the Edit button from the Quote view.
renewaltemplateid__c Text (50) The Renewal template id configured in Zuora Setting for generating Renewal Quote PDF.
restapiurl__c Text (200) Zuora REST API endpoint URL
subscriptionautorenewdefault__c Checkbox Enable to default new termed subscriptions to Auto-Renew.
subscription_name_option__c Text (80) Set the default value for the Subscription Name when the Quote is sent to Zuora.
tcv_rollup_method__c Text (255)  
template_id__c Text (50) Generate Quote PDF template id configured in Zuora.
update_opportunity_amount_with_quote_tcv__c Checkbox When this is enabled, the Quote TCV amount is copied to the Opportunity Amount field when a Quote is created or updated.
use_blended_effective_price__c Checkbox Select this option to calculate blended effective price for Tiered/Volume charges. By default, effective price for Tiered charges is undefined.
use_customer_acceptance_date__c Checkbox If checked, the customer could specify the date on which the services or products within a subscription has been accepted by the customer.
use_sfdc_locale_for_zqdocs__c Checkbox Select to use Salesforce login user's locale to format Quote PDF and Word documents.
use_service_activation_date__c Checkbox If checked, the customer could specify the date on which the services or products within a subscription have been activated and access has been provided to the customer.
z360installed__c Checkbox If selected, Zuora 360 is installed in this org.
z360majorversion__c Text (3) Major version of this package. e.g. for version 3.1.2 the major version is 3.
z360minorversion__c Text (3) Minor version of the package. e.g. for version 3.1.2, the minor version is 1.
zquotesinstalled__c Checkbox If selected, Zuora Quotes is installed in this org.
zquotesmajorversion__c Text (3) Major version of this package. e.g. for version 7.1.4, the major version is 7.
zquotesminorversion__c Text (3) Minor version of the package. e.g. for version 7.1.3, the minor version is 1.

Example Code

Map<String,Object> zuoraConfigInfo = zqu.zQuoteUtil.getZuoraConfigInformation();

// example usage with casting of generic Object data
String configCurrency = (String)zuoraConfigInfo.get('currency__c');
Boolean generateInvoice = (Boolean)zuoraConfigInfo.get('generate_invoice__c');

Export Zuora Config settings

To export data for Zuora Config settings, you need to run the following script in the Salesforce anonymous window before the Zuora Quotes package uninstallation.

This script exports Zuora Config data into the Content version object.


 List < ApexClass > apexList = [select NamespacePrefix from ApexClass where Name like: '%zQuoteUtil%'];
       String nameSpace = '';
       if (!apexList.isEmpty()) {
          
           if (apexList[0].NamespacePrefix != null) {
               nameSpace = apexList[0].NamespacePrefix + '__';
           }
       }
       zqu__Zuora_Config__c sobj = new zqu__Zuora_Config__c();
       List<String> excludeStandardIndexedFields = new List<String>{'setupownerid','isdeleted','createddate','createdbyid','lastmodifieddate','lastmodifiedbyid','systemmodstamp'};
       Map<String, Object> zuoraConfigMap = new Map<String, Object>();
       for(String fieldApiName : zqu.zQuoteUtil.getZuoraConfigInformation().keySet()){
           if(!excludeStandardIndexedFields.contains(fieldApiName) && zqu.zQuoteUtil.getZuoraConfigInformation().containsKey(fieldApiName) && zqu.zQuoteUtil.getZuoraConfigInformation().get(fieldApiName)!=null){
               String namespacePrefixed_fieldApiName;
               if(new List<String>{'name','id'}.contains(fieldApiName)){
                   namespacePrefixed_fieldApiName = fieldApiName;
               }else{
                   namespacePrefixed_fieldApiName = nameSpace+fieldApiName;
               }
               sobj.put(namespacePrefixed_fieldApiName, zqu.zQuoteUtil.getZuoraConfigInformation().get(fieldApiName));
           }
       }
       ContentVersion cv = new ContentVersion();
       cv.ContentLocation = 'S';
       cv.Title = 'zuora_config_export';
       cv.PathOnClient = 'zuora config export.txt';
       cv.VersionData = Blob.valueOf(JSON.serialize(sobj));
       Database.saveResult sr = Database.insert(cv);
       if(sr.isSuccess()){
        System.debug('Successfully backed up the zuora config data :'+sr.getId());  
       }else{
        System.debug('Failed to back up the zuora config data :'+sr.getErrors()); 
      }