Loading

Important fields to consider on Test Class for Salesforce CPQ

Data pubblicazione: Sep 27, 2025
Descrizione
When working on Unit Tests, you always need to generate sample data to be used in the tests. This article covers the required fields for each object that needs to be inserted when creating sample datasets.

You can append other fields per your requirement.
Risoluzione

Fields on each object to populate (Note that in case your org has other fields on each object marked as “Required”, those fields need to be inserted as well. )


Product

Field LabelAPI
Product NameName
ActiveIsActive
Product CodeProductCode

 

Price Book Entry

Field LabelAPI
ProductProduct2Id
Price BookPricebook2Id
List PriceUnitPrice
ActiveIsActive

 

Account

Field LabelAPI
Account NameName
Renewal ModelSBQQ__RenewalModel__c

 

Opportunity

Field LabelAPI
Opportunity NameName
AccountAccountId
StageStageName
Close DateCloseDate
price bookPricebook2Id


Opportunity Product

Field LabelAPINotes
ProductProduct2Id 
OpportunityOpportunityId 
Price Book Entry IDPricebookEntryId 
Total PriceTotalPrice 
QuantityQuantity 
Quote LineSBQQ__QuoteLine__cThis is not required, however, it is needed to simulate CPQ behavior.

 

Quote

Field LabelAPINotes
AccountSBQQ__Account__c 
OpportunitySBQQ__Opportunity2__c 
Price BookSBQQ__PricebookId__c 
Start DateSBQQ__StartDate__cThis is not required, however, it is needed to simulate CPQ behavior.
Subscription TermSBQQ__SubscriptionTerm__cThis is not required, however, it is needed to simulate CPQ behavior. You can also insert an End Date (SBQQ__EndDate__c) field instead of Subscription Term.

Include Primary (SBQQ__Primary__c) if needed to test order or contract processes.
 

Quote Line

Field LabelAPI
QuoteSBQQ__Quote__c
ProductSBQQ__Product__c
Price Book Entry IDSBQQ__PricebookEntryId__c
QuantitySBQQ__Quantity__c

In case you would need to test Parent-child product behavior, please insert SBQQ__ProductOption__c, SBQQ__RequiredBy__c, SBQQ__OptionLevel__c, SBQQ__OptionType__c fields.
 

Contract

Field LabelAPI
Account NameAccountId
OpportunitySBQQ__Opportunity__c
QuoteSBQQ__Quote__c
Contract Term (months)ContractTerm
Contract Start DateStartDate
Renewal Pricebook IdSBQQ__RenewalPricebookId__c
Amendment Pricebook IdSBQQ__AmendmentPricebookId__c

 

Subscription

Field LabelAPI
AccountSBQQ__Account__c
ContractSBQQ__Contract__c
ProductSBQQ__Product__c
QuantitySBQQ__Quantity__c

Please refer to the fields mentioned in the Legacy data upload with Renewals and Amendments in Salesforce CPQ article in case you need to create a dependency between subscriptions or assets.


Order

Field LabelAPI
Account NameAccountId
QuoteSBQQ__Quote__c
OpportunityOpportunityID
Order Start DateEffectiveDate
StatusStatus

 

Order Product

Field LabelAPI
OrderOrderId
ProductProduct2Id
Unit PriceUnitPrice
QuantityQuantity
Start DateServiceDate
End DateEndDate

Numero articolo Knowledge

000390047

 
Caricamento
Salesforce Help | Article