API & Development

How do I synchronize custom fields to Salesforce from Zuora without code?

How do I synchronize custom fields to Salesforce from Zuora without code?

This article explains how to synchronize custom fields created in the Zuora application to Salesforce. 

Synchronize a Custom Field

Zuora 360 supports fields of String, Date, and Picklist types in the Product Catalog sync and the Accounts and Related Objects sync. 

Custom fields are synchronized when the Zuora objects synced to Salesforce. See Sync Objects Mappings for the list of Zuora objects synchronized to Salesforce. 

To synchronize a custom field:

  • In the Zuora application, navigate to Settings > Billing > Manage Custom Fields, and define the custom field as described in Manage Custom Fields.
  • Define the corresponding field in Salesforce with the same API name. You must create the field in Salesforce before you can sync Zuora custom field data. You can synchronize custom fields up to 255 characters long. For the picklist type custom fields, each picklist option can be up to 255 characters long.
    • For example: Create a subscription custom field in Salesforce by going to Setup > App Setup > Create > Objects > Subscription > New Custom Fields & Relationships. Create the same custom field as you created in Zuora using the same field attributes, such as picklist, values, API Name.
  • Add the custom field on the Salesforce related list.
    • For example, if you are adding a subscription custom field, go to Setup > App Setup > Customize > Accounts > Page Layouts > Account Z-Force 360 Layout v## (latest version) > Edit the Related List for Subscriptions and add the custom field you created in the prior step.
  • The sync process will automatically sync the custom fields to Salesforce. Your Zuora 360 sync will execute according to your sync settings in Zuora. See Synchronize Data from Zuora about setting sync options. In the Field Name field, you can enter a value, for example, MyCompanySKU, and Salesforce will insert the required __c custom field suffix automatically.
  • After the sync is completed, refresh the Salesforce account page. The custom fields will now show the value that came from Zuora.

 

Using Postman and CSV data files to mass update Zuora data

Postman is the complete toolchain for API developers, used by more than 3 million developers and 30,000 companies worldwide. Postman makes working with APIs faster and easier by supporting developers at every stage of their workflow, and is available for Mac OS X, Windows, Linux and Chrome users. Best of all, it is free to use.

Postman’s Collection Runner is a powerful tool. As its name implies, the Collection Runner (CR) lets you run all requests inside a Postman collection one or more times. It also executes tests and generates reports so you can see how your API tests compare to previous runs.

There is a comprehensive blog post on how to create and use Postman and csv files here:

http://blog.getpostman.com/2014/10/28/using-csv-and-json-files-in-the-postman-collection-runner/

We'll bridge the gap between that blog post and how it applies to Zuora in the remainder of this blog post.

If you can use Zuora Connect, you can use Postman to do many of the same functions. Here are the high level steps that need to be completed:

  1. Create a Collection
  2. Create a Request
  3. Launch the Runner
  4. Create your CSV file with the headings the same name as the Zuora Request Body field names. Select the file from the Runner interface.
  5. Start the Runner
  6. Your request should complete successfully

Creating a Collection

Please view the following Postman Article: https://www.getpostman.com/docs/postman/collections/creating_collections

Creating the Request

To create the request, here is the Postman Article: https://www.getpostman.com/docs/postman/sending_api_requests/requests

1. Choose the Request Type, in this case PUT as we are updating Account fields

2. Enter your Server URL. In this example, we will mass update the Notes field on the Account so our Server URL is: https://rest.zuora.com/v1/accounts/{{Id}}

Zuora is particular and requires a path parameter. The path parameter can either be Account number or Account ID. In my example, I have chosen the Id.

The following are Notes from the Zuora Developer Docs:

  • Only the fields to be changed should be specified in the Request Body. Any field that's not included in the request body will not be changed.
  • If an empty field is submitted with this call, the corresponding field in the account is emptied.
  • Email addresses: If no email addresses are specified, no change is made to the email addresses on file or to the email delivery preference. If either the personalEmail or workEmail is specified (or both), the system updates the corresponding email address(es) on file and the email delivery preference is set to true. (In that case, emails go to the workEmail address, if it exists, or else the personalEmail.) On the other hand, if as a result of this call both of the email addresses for the account are empty, the email delivery preference is set to false.
  • The bill-to and sold-to contacts are separate data entities; updating either one does not update the other.

3. Choose the Authorization Type as Basic Auth, enter your username and password

4.  Enter the headers. I've chosen Key= Content-type | Value = application/json

5. Create the JSON Request Body

  • {
      "notes": "{{notes}}"
    }

6. Create the Pre-Request Scripts

  • console.log("Body contains Id" + data.Id);
    console.log("Body contains notes" + data.notes);

7. Create your Tests

  • tests["Body matches string"] = responseBody.has("true");

Launch the Runner

Once you click the Runner button at the top of the Postman UI, a new screen will launch called the Collection Runner'.

Fill out the details and upload your CSV file before clicking the Run button. Here is an article that explains all of the fields and variables:

https://www.getpostman.com/docs/postman/collection_runs/starting_a_collection_run

Once you click the blue 'Run' button at the bottom of the Runner screen, you should see the request results complete succeessfully:

A few last minute tips:

1. We were unable to get this to successfully complete with the web UI. We had to download the desktop app.

2. If you are having debugging issue, try viewing the console. It has helpful debugging details. You can access the console from the menu: view > Show Postman Console