Knowledge Center

Knowledge Center > Commerce > Zuora for Salesforce Development Resources > Zuora for Salesforce Component Library > Zuora for Salesforce Global Classes > ProductListViewSyncController Class

ProductListViewSyncController Class

The ProductListViewSyncController class manages the synchronization of the Product Catalog from Salesforce to Zuora.

The ProductListViewSyncController class is available in the Versions 7.0 and later of Zuora Quotes.

To use this class, you must have the Enable Bundling setting enabled in Salesforce and Zuora.

ProductListViewSyncController Class Global Method

The following global method is supported in the ProductListViewSyncController class.

Method Return Type Description
remoteSync 
(List <String> sfdcObjectIds, String objectType)
List <String>

The method syncs all records and their child relationships.

This method accepts a List of Salesforce object Ids along with the Zuora SOAP API name of the object you want to sync.

As of the version 8.0.3, only the objectType of Product2 is supported.

The total number of objects being synced, including all children objects, cannot exceed 10,000.

The method will attempt to sync the records by batching them into Apex Queued Jobs.

If successful, the method returns a list of job Ids, which you can use to poll for the completion of the job. The first Id returned in the list is the Salesforce Id of the zqu__Catalog_Sync_History__c record related to the sync attempt.

Sample Code

The following code syncs all products, product rate plans, product rate plan charges and product rate plan charge tiers from Salesforce to Zuora.

List < String > productIds = new List < String >();
List < Product2 > productsToSync = 
    [SELECT Id FROM Product2 WHERE zqu__Deleted__c = FALSE];
 
for (Product2 prod : productsToSync) {
    productIds.add(String.valueOf(prod.Id));
}
 
List < String > syncIds = 
    zqu.ProductListViewSyncController.remoteSync(productIds, 'Product2');
List < String > apexQueueJobIds = new List < String >();
 
for (Integer i = 1; i < syncIds.length(); i++) {
    //The Apex Queue Job Ids start from the second element in the list
    apexQueueJobIds.add(syncIds[i]);
}
Last modified
13:52, 20 Jan 2017

Tags

This page has no custom tags.

Classifications

(not set)