Happy Business Starts Here

Scholar

Sync Salesforce custom Account field to Zuora?

Is it possible to sync a custom field on the Salesforce Account object to Customer Account in Zuora automatically?  We don't use Quotes or push any data to Zuora from Salesforce currently, but would like this one field to be synced to Zuora.  Possible?

4 REPLIES 4
Guru

Re: Sync Salesforce custom Account field to Zuora?

@KerryMcD it is certainly possible, but would require some Apex code in Salesforce to handle this.

 

Most likely flow would be:

 

1. Add an Apex trigger to detect changes to that field on the Salesforce object

2. Find the Zuora account for that SF Account

3. Use the Order Buider API to issue an update to the account.

https://knowledgecenter.zuora.com/CA_Commerce/F_Development_Resources/B_Order_Builder/D_Programming_...

 

Notes:

In step 2 you need the Zuora account, but it is technically possible for a Salesforce Account to be linked to more than one billing account. In our environment we restrict it to exactly one since the account numbers are set to match and must be unique, but this is something to consider on your environment.

 

The Order Builder API is subject to the Apex governor limits for callouts which means you can make at most 100 calls per transaction. You will need to ensure to "bulk-ify" your code so that you provide the zupdate() call a list of accounts to change rather than calling it over and over with each account change. This is general Salesforce best practices, but I wanted to call it out since its a common mistake.

Guru

Re: Sync Salesforce custom Account field to Zuora?

I also send updates to Zuora for Account events and changes.  I have a future method (that allows callouts) that creates and sends the list of account updates to Zuora.

 

I invoke this method in several places from triggers and batch jobs.

 

We do allow multiple Zuora accounts to one salesforce accounts so I have to careful to update the appropriate Zuora Account..

Maggie Longshore
Student

Re: Sync Salesforce custom Account field to Zuora?

Hi Maggie,

Can you please help me out with future methods and triiger that you use to update Zuora Account Details.

Guru

Re: Sync Salesforce custom Account field to Zuora?

After answering before I have since changed my application to use a Queueable method to sent the updates to Zuora when needed.

 

You will need an Apex Developer to do this if you are not one.

An Apex developer will know how to create the trigger.

 

Here is an example of the queueable class I use.

See the response below from @feisley and links below for more information on using zupdate()

 

 

public class UpdateZuoraObjectsQueueable  implements Queueable, Database.AllowsCallouts {

    public void execute(QueueableContext SC) {
     	zoqlUtils.UpdateZObjects(zuoraObjects, 50, objectName); // you will put you custom class and method here
    }

    private List<Zuora.zObject> zuoraObjects {get;set;}
    private String objectName {get;set;}

    public UpdateZuoraObjectsQueueable(List<Zuora.zObject> objs, String objectName) {
	this.objectName = objectName;
	this.zuoraObjects=objs;
    }
}

 

 

 

See Salesforce-Apex-trigger-to-update-record-on-Zuora

How-to-implement-logic-to-update-Billing-Batch-automatically

Maggie Longshore