Using JavaScript in Zuora Workflows

By Lana Lee posted 07-10-2023 08:19


At our June 27th Workflow Workshop, Product Manager of Platform and Workflow Karn Singh along with several of our engineers shared an exciting new query task that allows building powerful workflows with fewer steps - a milestone gamechanger for Zuora Workflow! What would normally take several hours to build a workflow sequence that created bulky data structures, is now reduced to a small handful of tasks that can be reviewed in real-time.

JavaScript in Workflow

We recently launched JavaScript tools allowing quick and agile scripting, reducing the time it takes to build, test, deploy using the Swimlane page and JS Tester, returning variables in your JavaScript function to your data payload. Not only does this save time, it allows users to be fully immersed in the workflow-building experience to quickly and easily deploy solutions.

Using Javascript in Zuora Workflow

Build Powerful Workflows Quickly with Our New Query Task

We’re excited to announce a new query task that will help you build powerful workflows with a data retrieval mechanism for quick/synchronous fetches with the enhanced ability to fetch from multiple linked objects and point-and-click filters. What used to take six different tasks together to get your desired data, can now be done using just one task! If you’ve never built a Workflow before, we encourage you to try it out.

This feature is accessible in all currently available Workflow Types in all environments and tenants.

Example: Building a Payment Notification Workflow Using the New Query Task

The new query task - accessible in all currently available Workflow Types in all environments and tenants - allows building powerful workflows in fewer steps through a point-and-click data retrieval mechanism for quick/synchronous fetches with the enhanced ability to fetch from multiple linked objects.

In this example, we demonstrate triggering a Workflow on a PaymentProccessed Event using near real-time functionality with high-priority assignment


Q&A Hightlights


  1. What javascript version does this feature use?
    • ES6
  2. When new versions of Javascript come up, will Zuora automatically use that newest version? How will we know which version is being used?
    • We do not plan on auto-upgrading any existing JavaScript code. If new versions come out and we decide to support it, it will be on in opt-in basis to choose your version. Otherwise, wide-spread notices will be made if there are any forced upgrades.
  3. Can we import libraries from NPM?
    • Self-serve for importing NPM packages is not available currently, as there are large-scale security implications for untrustworthy resources. Users should reach out to the Workflow team for requests to support any packages. The Workflow team will vet out the viability and security qualifications, and if approved will add it.
  4. Are there any templates in Zuora for Workflows using a JavaScript task? And will there be any updates to Zuora University to include these newer task types?
    • Templates and Zuora University are coming soon.


  1. Is the javascript package available in the data payload tree for downstream task reference?
    • Yes, the Data Payload is accessible inside the JavaScript function.
  2. Is the JS task available in EU SBX?
    • It is available in all environments and regions.


  1. Can we use the Query Task with the liquid code as well or is this just only limited to the JavaScript code editor?
    • The Query Task support Liquid expressions.
  2. On the Query Task, can we change the objects that are joined? I think in the example you showed the Product Rate Plan Charge is joined under the invoice, but it seems like the Subscription Rate Plan Charge would be more relevant.
    • Users can select a base object and select any object that is available in the tree.
  3. What is the required ID field in the query task ? Is that a static value that we need to pass while building the query task ?
    • The required Id field is for the selected base object. Users can use Liquid expressions to dynamically parse the Id.
  4. Is it possible to use the Query task for scheduled workflows as well?
    • Yes, the Query Task is available for all Workflow Types.
  5. Can we use multiple functions in a single JS task?
    • Yes

Learn More

Review Presentation | Watch Full Recording

Stay Updated on All Things Workflow-Related

We have a number of exciting releases coming to Workflow in the coming months and you will want to be the first to hear about them by subscribing to Release Notifications.  Future Workflow workshops are announced monthly in the Community News where you can also hear about other product updates and other exciting events.

And if you haven’t yet had time to attend a Workflow workshop, we encourage you to register for our next session. Community Workshops are excellent opportunities for Zuora users of all skill levels to collaboratively work together to solve common challenges with the guidance of a Zuora subject matter expert and the support of your peers. Not only will you be able to hear how others are using Zuora, but it is also a great chance to share tips of your own.  



03-20-2024 14:17

Hi @Ranjeet Shinde

They'll be adding new sample workflows to the template library by this summer...stay tuned! 


03-20-2024 11:07

@Ranjeet Shinde - Let me follow up with @Karnbir Singh!

03-11-2024 03:40

Do we have sample workflows to refer