Build a Workflow That Ignores Specific Invoices in Transfer to Accounting

Edited

Overview

In Zuora, managing invoices efficiently is crucial for accurate accounting and financial reporting. This article outlines a workflow designed to automatically update the "Transferred to Accounting" field to "Ignore" for invoices that meet specific criteria. Specifically, the workflow targets posted invoices containing a certain product rate plan, ensuring they are not transferred to your accounting system.

Audience

This guide is intended for Zuora system administrators and business analysts responsible for billing operations and workflow configurations.

Prerequisites

  • Permissions: Access to Zuora Workflow and the ability to create and modify workflows.

  • Product Rate Plan Identification: Knowledge of the specific product rate plan that should trigger the invoice to be ignored in the accounting transfer.

Workflow Summary

The workflow consists of the following tasks:

  1. Access Zuora API Sandbox

  2. Create a New Workflow

  3. Select Unprocessed Invoices (Object Query)

  4. Iterate Over Invoices (Iterate)

  5. Invoice Details Retrieval (Query)

  6. Check for Specific Product Rate Plan (JavaScript)

  7. Evaluate Condition to Ignore (If Condition)

  8. Update "Transferred to Accounting" Field (Update)


Step-by-Step Configuration

Task 1. Access Zuora API Sandbox

Start by logging into the Zuora API Sandbox environment. This environment allows you to develop and test your workflows before deploying them to production.

Task 2. Create a New Workflow

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

Once you create the new workflow, navigate to the settings to define the global variable for the Rate Plan you wish to filter on.

Here we have defined the input as ProductRatePlanChargeId and set the default value.

As an example, the final workflow will resemble the diagram below when complete.

Task 3: Select Unprocessed Invoices

Type: Object Query

Objective: Retrieve all posted invoices that have not yet been processed or 'transfer to accounting'.

Configuration:

  • Object: Invoice

  • Filter Criteria (Conditions):

    • Status = 'Posted'

    • TransferredToAccounting = null

  • Fields to Retrieve: Invoice Number, Account ID, Invoice ID, etc.

Example Query:

Status = 'Posted' 
AND 
TransferredToAccounting = null

Below are screenshots of fields to select and the conditions to specify for this task to be complete. Please note, your conditions may vary based on your use case.

Please note: The conditions tab in the Object Query task behaves as a WHERE clause; you do not need the SELECT or WHERE keywords. The SELECT function was done under the Fields tab.

Task 4: Iterate Over Invoices

Type: Iterate

Objective: Loop through each invoice retrieved in Task 3.

Configuration:

  • Input List: Results from Task 3

  • Iteration Variable: InvoiceList

Task 5: Invoice Details Retrieval

Type: Query

Objective: Fetch detailed information about the current invoice, including associated rate plans.

Configuration:

  • Object: Invoice Item

  • Base Object: Invoice

  • Id: {{Data.InvoiceList.Id}}

  • Fields to Retrieve: Charge ID, Product Rate Plan ID, etc.

Task 6: Check for Specific Product Rate Plan

Type: JavaScript

Objective: Determine if the invoice contains the specific product rate plan that should be ignored.

Configuration:

  • Payload Placement: RatePlanEval

  • Script:

exports.step = function test(input) {
  var ret = {};
  ret.shouldDisable = false;
  
  for (var i=0; i< input.Invoice.invoice.invoiceitems.length; i++) { 
    var item = input.Invoice.invoice.invoiceitems[i];
    if (item.RatePlanCharge.ProductRatePlanCharge.Id == input.Workflow.ProductRatePlanChargeId) ret.shouldDisable = true;
  }
                                                             
  
  return ret;
};

Task 7: Evaluate Condition to Ignore

Type: If Condition

Objective: Decide whether to update the "Transferred to Accounting" field based on the result from Task 6.

Configuration:

  • Condition:

    {% if Data.RatePlanEval.shouldDisable  %}
    True
    {% else %}
    False
    {% endif %}

Task 8: Update "Transferred to Accounting" Field

Type: Update

Objective: Set the "Transferred to Accounting" field to "Ignore" for invoices that meet the criteria.

Configuration:

  • Object: Invoice

  • Id: InvoiceList.Id

  • Fields to Update:

    • TransferredToAccounting = 'Ignore'

Final Notes

  • Testing: Before deploying the workflow to production, test it in a sandbox environment to ensure it behaves as expected.

  • Scheduling: Consider scheduling the workflow to run at regular intervals to automate the process.

  • Logging: Enable logging within the workflow to monitor its execution and troubleshoot if necessary. This is most easily achieved through a Javascript task that is at the output of the task you wish to debug.

Final Thoughts

By implementing this workflow, you automate the process of excluding specific invoices from being transferred to your accounting system. This ensures that only relevant financial data is synced, streamlining your accounting operations and reducing the risk of errors.