Knowledge Center

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

ProductSyncUtil Class

The ProductSyncUtil class contains global methods for programmatically triggering product synchronization and cleanups from Salesforce to Zuora. The global methods support the following in the single-entity and multi-entity environments:

  • Synchronizing Products, Features, UOMs, and related objects from Salesforce
  • Deleting Products, Features, UOMs, and related objects in the Zuora product catalog
    When you mark the products and features to be deleted in the Product Sync UI in Salesforce, the syncProducts global method will delete the product in the Zuora product catalog.

ProductSyncUtil Global Methods

The ProductSyncUtil class provides the following global methods to sync or delete products and related objects.

Method Return Type Description

setBatchSize

(Integer batchSize)

void

You can use the method to reduce the number of products to be synced per batch if you are syncing complicated products.

If not set, the default batch size is 50.

syncProducts

(List < ID > ids)

List <ID>

Synchronizes a list of given products and returns the sync history job ids.

If syncing in a multi-entity environment, the method returns the sync history job id in each entity.

The products marked for delete are deleted from the Zuora product catalog by this method.

Code Sample

The sample code calls the syncProducts global method with a set of Product ID's to synchronize. The products and all of their child objects are synchronized to Zuora.

List<Product2> prods = [SELECT Id FROM Product2];
List<Id> productIds = new List<Id>();
for(Product2 prod : prods) {
      productIds.add(prod.Id);
}

zqu.ProductSyncUtil util = new zqu.ProductSyncUtil();
Id[] historyIds = util.syncProducts(productIds);
Last modified
12:49, 30 Dec 2016

Tags

This page has no custom tags.

Classifications

(not set)