Welcome to Zuora Product Documentation

Explore our rich library of product information

Domain-Specific Language function examples

Explore the examples of Domain-Specific Language (DSL) functions for Salesforce and Zuora integration, including LOOKUP, LOOKUPBY, and IF functions, to derive pricing and map fields.

The following three functions can be used either together or separately, depending on your specific use case. The Salesforce Account is used to determine where the Vertical field value comes from for price derivation.

LOOKUP example

Fetch a field using an Id-based lookup.

For example, fetch Vertical__c from Account linked to the quote.
LOOKUP(Account, zqu__Quote__c.zqu__Account__c, Vertical__c)
  • Looks up the Account record where Account.Id = Quote.zqu__Account__c.
  • Returns the value of Vertical__c from the Salesforce Account record.

This always uses the Zuora Subscription Owner Account to determine where the Vertical field value comes from for price derivation. This does not return any value for a new Billing Account quote.

LOOKUPBY example

Fetch a field using a non-Id field (e.g., external ID).

For example, retrieve Vertical__c from Zuora__CustomerAccount__c where IDs match.

LOOKUPBY(Zuora__CustomerAccount__c, Zuora__Zuora_Id__c, zqu__Quote__c.zqu__ZuoraAccountID__c, Vertical__c)
  • Finds the Zuora__CustomerAccount__c record where Zuora__Zuora_Id__c = Quote.zqu__ZuoraAccountID__c.
  • Returns the value of the Vertical__c field from the record found in the Zuora__CustomerAccount__c object.

This allows for conditional Vertical field derivation based on whether the quote's Subscription Owner Account exists or not.

IF example

Conditional logic.

For example, conditionally identify existing or new customers.

IF(zqu__Quote__c.zqu__ZuoraAccountID__c, "Existing", "New")

Example 1

Scenario:

Create a Context Attribute Vertical that:

  • Uses Subscription Owner Account if available.

  • Falls back to Billing Account.

  • Defaults to Quote's Salesforce Account if new.

Final DSL Formula

IF(
  zqu__Quote__c.zqu__ZuoraAccountID__c,
  IF(
    zqu__Quote__c.zqu__Subscription_Owner_ZuoraId__c,
    LOOKUPBY(Zuora__CustomerAccount__c, Zuora__Zuora_Id__c, 
             zqu__Quote__c.zqu__Subscription_Owner_ZuoraId__c, Vertical__c),
    LOOKUPBY(Zuora__CustomerAccount__c, Zuora__Zuora_Id__c, 
             zqu__Quote__c.zqu__ZuoraAccountID__c, Vertical__c)
  ),
  IF(
    zqu__Quote__c.zqu__Account__r.Vertical__c,
    zqu__Quote__c.zqu__Account__r.Vertical__c,
    LOOKUP(Account, zqu__Quote__c.zqu__Account__c, Vertical__c)
  )
)

Logical flow

Condition

Action

zqu__ZuoraAccountID__c exists → Existing customer

Use Zuora Account’s Vertical field value

zqu__Subscription_Owner_ZuoraId__c exists → Renewal/Amendment

Use Subscription Owner's Vertical__c

Else

Use Billing Account's Vertical__c

No Zuora Account → New Quote

Try direct Quote.Account.Vertical__c

Else

Fallback to Salesforce Account Vertical field value

Example 2

Map Subscription Field Size__c to Quote.

Setup:

  • Custom field Size__c on Zuora Subscription

  • Same field on zqu__Quote__c in Salesforce

  • Added to field sets: zqu__CustomQuoteFields, zqu__CustomQuoteQueryFields

CRM Mapping formula

zqu__Quote__c.Size__c