Build a Zuora Workflow that sends a custom field to NetSuite

Edited

Use Case

Action: Develop a workflow in Zuora

Description: The workflow needs to map and send the payment method type from Zuora to a NetSuite endpoint. This process involves mapping the payment method to its corresponding NetSuite Internal ID and including this ID in the API call's payload. The URL for the API call must contain the NetSuite payment transaction ID, which is available in Zuora under the "NetSuite Integration ID" field.

Filter Logic: Identify payments from the past 24 hours where the "PaymentMethodTypeSyncedToNS__c" field is not set to TRUE.

Schedule: Run Hourly

Detailed Mapping Explanation:

Company requires the NetSuite Internal ID of the payment method to be included in the body of the API request. The NetSuite payment transaction ID, found in Zuora's "NetSuite Integration ID" field, must be included in the URL.

Here are the payment methods and their corresponding IDs in NetSuite, which Zuora should send and populate in the custom field:

  • ACH = 19

  • Check = 1

  • Credit Card = 6

  • Wire Transfer = 3

  • CC Reference Transaction = 12

  • Bank Transfer = 14

  • Other = 16


Steps to Create the Workflow in Zuora

To create the workflow described in the document for updating the Payment Method ID in Zuora and sending it to NetSuite, you would follow the steps below.

High Level Description:

  1. Access Zuora API Sandbox

  2. Create a New Workflow

  3. Select Payments Task (export)

  4. Iterate over payments Task (iterate)

  5. NetSuite Callout Task (callout)

  6. Update Payment Method Type Sync'd to NetSuite Task (update)

  7. Email Errors if Sync Failed Task (email)

  8. Schedule Workflow

  9. Test before deployment


1. Access Zuora API Sandbox:

  • Log into the Zuora API Sandbox using the credentials stored in 1Password (Zuora Matterport Sandbox).

2. Create a New Workflow:

  • Navigate to the Workflow section in Zuora and create a new workflow.

  • Name the workflow to continue adding the remaining tasks in #3-#7 below.

As an example, the final workflow will resemble the following diagram:

3. Create the Select Payments Task with Filter Logic:

  • Objective: The workflow should filter payments with a timestamp from the last 24 hours where the custom field PaymentMethodTypeSyncedToNS__c is not equal to TRUE.

  • Steps:

    • Create a "Query" task to search for payments. In the query, set up conditions to filter payments that:

      • Have a timestamp within the last 24 hours.

      • Have the custom field PaymentMethodTypeSyncedToNS__c set to FALSE.

    • Select all of the fields needed from the Fields tab

    • On the Conditions tab, enter the query example below; please note that this is a WHERE clause so you do not need the SELECT or WHERE arguments typically included in an SQL statement.

    • Example query:

      CreatedDate >= 'today'
      AND PaymentMethodTypeSyncedToNS__c = FALSE

4. Create the Iterate Over Payments Task:

  • Objective: Now that you have retrieved the list of payments that meet the filter logic specified, you need to iterate over each one.

  • Steps:

    • Create a "Iterate" task

      • Set the Iteration Type to 'Every Item'

5. Callout Task Setup:

  • Objective: For each payment that meets the filter criteria, send an API request to the specified NetSuite endpoint.

  • Steps:

    • Use a "Callout" task to set up the API call to NetSuite.

    • The URL should include the NetSuite Integration ID from Zuora's NetSuiteIntegrationID__c field.

    • The body of the callout should include the mapped NetSuite Internal ID of the payment method.

    • Example URL structure:

      https://{{youraccountid}}-sb3.suitetalk.api.netsuite.com/services/rest/record/v1/customerPayment/{{Data.Payment.IntegrationId__NS | default: 'PLACEHOLDER_ID'}}
    • Example callout body structure:

      {% assign paymentMethodMapping = '{"ACH":7,"Check":2,"CreditCard":8,"WireTransfer":10,"CreditCardReferenceTransaction":12,"CC Reference Transaction":12,"BankTransfer":13,"Other":14}' | parse_json %}
      {
        "custbodyzuo_pay_meth_upd": {{paymentMethodMapping[Data.PaymentMethod.Type] | default: 0}}
      }

6. Mark Payment as Synced if Success

  • Objective: After successfully sending the payment method type to NetSuite, update the PaymentMethodTypeSyncedToNS__c field in Zuora to TRUE.

  • Steps:

    • Use an "Update Record" task in the workflow to set PaymentMethodTypeSyncedToNS__c to TRUE for each payment that was successfully processed.

7. Email Errors if Sync has Failed

  • Objective: If sending the payment method type to NetSuite fails, then send an email containing the errors.

  • Steps:

    • Create an email task, fill out the necessary parameters for your use case.

8. Schedule the Workflow:

  • Objective: Ensure the workflow runs automatically every hour.

  • Steps:

    • Set up a schedule for the workflow to run once an hour, as specified.

9. Test and Monitor:

  • Objective: Validate that the workflow is functioning correctly.

  • Steps:

    • Test the workflow in a sandbox environment to ensure it correctly filters, maps, sends API requests, and updates records.

    • Monitor the workflow's execution and log any errors for troubleshooting.

By following these steps, you should be able to create a Zuora workflow that automates the process of sending payment method types to NetSuite, marking records as synced, and scheduling the workflow to run hourly.