ZSBConnectorUtils Class

Knowledge Center > Zuora CPQ > Zuora Connector for Salesforce CPQ > Global Classes in Zuora Connector for Salesforce CPQ > ZSBConnectorUtils Class

ZSBConnectorUtils Class

ZSBConnectorUtils Global Methods

The ZSBConnectorUtils class contains the following global methods in Salesforce CPQ.

Method Return Type Description
createContractFromOpportunity
(Id opportunityId)
void

Creates contracts from contacts - one at a time.

Converts the primary quote to a contract for an opportunity. 

If the Billing Account does not exist in Zuora, this method will create the Billing Account in Zuora.

createContractFromQuote
(Id quoteId)
void

Creates contracts from quotes - one at a time.

Converts a quote to a contact.

If the Billing Account does not exist in Zuora, this method will create the Billing Account in Zuora.

syncProductsToZuora
(SET<Id> products)
void Sync products to Zuora.
deleteProductsFromZuora
(SET<Id> products)
void Deletes products from Zuora.
sendContractsToZuora
(SET<Id> contracts)
void Sends contracts to Zuora.
makeAmendmentSummaries
(Id contractId)
List<zsb.AmendmentSummary> Retrieves a List of AmendmentSummaries from a Contract that has Products added to it.

Sample Code

Send Contract to Zuora

To programmatically send a contract to Zuora, set the Send to Zuora (ZSB__SubscribeToZuora__c) field on the Contract object to true as shown in the code sample below.

A contract is sent to Zuora asynchronously. When the response comes back from Zuora, the Zuora Sync Status (ZSB__ZuoraSyncStatus__c) field on the Contract object will be populated with the results.

Contract c = [select Id FROM Contract Where Id='8003600000086iM' LIMIT 1];
c.SubscribeToZuora__c = true;
update c;

Sync Products to Zuora

See the code sample below for how to programmatically sync products to Zuora.

SET<Id> products = new SET<Id>();
products.add('01tf4000000jLVf');
ZSB.ZSBConnectorUtils.syncProductsToZuora(products);

Delete Products from Zuora

See the code sample below for how to programmatically delete products from Zuora.

SET<Id> products = new SET<Id>();
products.add('01tf4000000jLVf');
ZSB.ZSBConnectorUtils.deleteProductsFromZuora(products);

Send Contract to Zuora

See the code sample below for how to programmatically send contracts to Zuora.

SET<Id> contracts = new SET<Id>();
contracts.add('800f4000000cCgQ');
ZSB.ZSBConnectorUtils.sendContractsToZuora(contracts);

Retrieve a List of AmendmentSummaries from a Contract

See the code sample below for how to programmatically retrieve a list of AmendmentSummaries from a Contract.

List<AmendmentSummary> summaries = ZSBConnectorUtils.makeAmendmentSummaries('8001Q000006r2Ci');
System.debug('Name: ' + (String) summaries[0].zamendment.getValue('Name'));
System.debug('Type: ' + (String) summaries[0].zamendment.getValue('Type'));
System.debug('Date: ' + (String) summaries[0].zamendment.getValue('ContractEffectiveDate'));

Zuora.zObject rpd = (Zuora.zObject) summaries[0].zamendment.getValue('RatePlanData');
Zuora.zObject[] rpcd = (Zuora.zObject[]) rpd.getArrayValue('RatePlanChargeData');
Zuora.zObject rpc = (Zuora.zObject) rpcd[0].getValue('RatePlanCharge');
String chargePrice = (String) rpc.getValue('Price');

System.debug('Price: " + chargePrice);
Last modified

Tags

This page has no custom tags.

Classifications

(not set)