Happy Business Starts Here

Honor Student

Slaesforce Apex trigger to update record on Zuora

Hi there,

What I'm trying to is I'm trying to push update from SFDC to Zuora when Zuora__CustomerAccount__c object gets updated in SFDC.

For example when Sales Rep field gets changed on Zuora__CustomerAccount__c I want it to be synced with Zuora as well.

I did a bit of research and I figured I need to write a trigger in Salesforce to invoke zUpdate method. I beleive that trigger is not too complicated but still it's not on my level.

Can anyone give me some snippet or some help how to write that trigger please?

Really appreciate any help!


Re: Slaesforce Apex trigger to update record on Zuora

@urbietis I would caution against making changes directly on the Zuora__CustomerAccount__c object in Salesforce as this is populated from data in Zuora by 360 sync. This is especially true for the fields that come bundled with the package. If you create your own fields on the CustomerAccount object you can change those without risk of sync overwriting them.


What you described would actually risk causing a loop in your system:

1. Update the Customer Account

2. It updates Zuora account

3. 360 sync sync's the change back to the Customer Account

4. Go to step 1...


In our system we consider the CustomerAccount a read-only view of the Zuora billing account and only automation can change fields on it (i.e. roll up values used for analytics).


If you want to sync changes back to Zuora, my suggestion is to use the main "Account" object and place triggers on it. In the example you provided you would do the following:


1. Create a trigger on 'Account'

2. In the trigger when the Sales Rep field is modified (aka the Owner field or custom field of your choosing) it would check if there is a linked billing account.

3. It could then use the Zuora API to set that Sales Rep in Zuora

4. Behind the scenes Zuora 360 would sync the Sales Rep field back to the CustomerAccount object as it normally does.

Honor Student

Re: Slaesforce Apex trigger to update record on Zuora

Hi @feisley,

Thanks for your time putting all this together.

I see your point, but to mitigate that I can make a trigger on Account object as you say, so Zuora 360 would not be able to trigger zUpdate() again even after syncing back to SFDC.

But your idea is interesting, do you have any link for me maybe to read more on Zuora API, how to change SalesRep field and how it works?


Many thanks,


Zuora Alumni

Re: Slaesforce Apex trigger to update record on Zuora

Thank you very much @feisley.


Hi @urbietis,


Please review the following article for the detail on how to use zupdate() call . This has documented  sample code as well




Hope this helps


Thank you

If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √