Skip to main content

OnDemandSyncManager and SyncResult Classes

Zuora

OnDemandSyncManager and SyncResult Classes

OnDemandSyncManager Class

Zuora.OnDemandSyncManager is the main global Apex class.  

OnDemandSyncManager Properties

The OnDemandSyncManager class includes the following properties.

 Property  Type      Description
emailNotificationEnabled     Boolean

Indicates whether an email notification should be sent to the current user once the sync request is sent.

The default value is true. 

syncObjectIdSet        Set<Id>

A set of Salesforce IDs.  

If the syncObjectType is BILLING_ACCOUNT, this set should contain Zuora__CustomerAccount__c.Id.

If the sync object type is ZPRODUCT, this set should contain zqu__ZProduct__c.Id.

syncObjectType

OnDemandSyncManager.ObjectType 

The sync object type.  Possible values are: 

  • BILLING_ACCOUNT:  Billing account. This is the default value. 
  • ZPRODUCT: Product catalog
syncZuoraObjectIdByEntity Map<String, String>  A list of zuora ID's mapped to their corresponding entity ID.
syncZuoraObjectIdSet     Set<String>

A set of Zuora IDs. 

If the syncObjectType is BILLING_ACCOUNT, this set should contain Zuora Customer Account ID (32-character ID string).

If the syncObjectType is ZPRODUCT, this set should contain Zuora Product ID (32-charater ID string).

OnDemandSyncManager Method

Method    Return Type  Exception Thrown   Description
sendRequest    List<Zuora.SyncResult> OnDemandSyncManager.
OnDemandSyncException 

Sends the On-demand Sync request to Zuora. 

It can be invoked under both a trigger context and a non-trigger context:

  • If invoked under a trigger context, the On-demand Sync request will be sent as a Salesforce @future request, which will be executed asynchronously. If email notification is enabled, an email notification will be sent to the current user once the sync request is sent. 
  • If invoked under a non-trigger context, the On-demand Sync request will be sent synchronously. Thus the On-demand Sync request status will be returned as a list of the SyncResult objects. If email notification is enabled, an email notification will be sent to the current user once the sync request is sent.

Salesforce Callout Limits and On-Demand Sync Request

Currently, each object sync request is a Salesforce callout. Salesforce allows a maximum of 100 callouts per request. In an OnDemandSyncManager.sendRequest() call, you can sync up to 100 objects. If the call to OnDemandSyncManager.sendRequest() is part of a larger transaction, some callout limits might have been consumed prior to the call. When the callout limit is reached, the sync requests for the rest objects will return an error.

When the On-demand Sync is invoked under a trigger context, all Salesforce governor limits on @Future requests apply. 

SyncResult Class

The SyncResult class includes the status of the On-demand Sync request. This status is not the same as the status of the sync operation.

SyncResult Properties

The SyncResult class includes the following properties.

Property  Type      Description
jobId String The 32-charater sync job ID from Zuora. It is returned only if the sync job successfully completes.
sfdcName String

The Salesforce object name. 

The string, 'N/A', returns if there is currently not a Salesforce object associated with the Zuora object to be synchronized.

statusMessage     String The status message. If the sync request fails, it contains the error description.
success Boolean The success or failure status of the sync request.