Menu icon
  Help center      Automations & Integrations  
Code Task

Code Task

Updated March 7, 2025

Process Street‘s Code Tasks provide powerful automation capabilities by executing JavaScript within workflows.

Whether calculating costs, extracting data, setting task priorities, or defining unique business logic, this feature is useful for performing complex operations beyond standard workflow automation.

You can use these tasks to perform multi-step calculations and make API calls to calculate data from another tool within your workflows. This reduces the need for reliance on third-party tools to perform calculations for you.

Users: In order to add or change Code Tasks in a workflow, you must be an Administrator or a  Member who has been given ‘edit’ access by your Administrator.

Code Task is automatically available on our Enterprise plan. Please contact our Support team or your Account Executive to inquire about access. 

Use case examples

Here are just a few examples of how you can utilize Code Tasks, but the limits are really your imagination!

Financial

  • Credit Risk Assessment: Probability of Default (PD) × Loss Given Default (LGD) × Exposure at Default (EAD)
  • Return on Investment (ROI): (Net Profit / Investment Cost) × 100
  • Liquidity Ratios: Current Assets / Current Liabilities
  • API call example: Fetching current currency conversion ratios or stock prices via API

Healthcare 

  • Cost-Benefit Analysis for Medical Equipment: (Total Benefits of Equipment – Total Costs) / Total Costs
  • Patient Risk Scoring: Likelihood of Readmission × Severity of Illness
  • Healthcare Claims Processing:  Total Claims Submitted – (Denied Claims + Adjusted Claims)
  • API call example: Submit the provided equipment order to a database API

Property Management 

  • Rental Yield: (Annual Rental Income / Property Value) × 100
  • Maintenance Cost Forecasting: Average Annual Maintenance Cost per Property × Number of Properties
  • Depreciation Calculations: (Cost of Property – Salvage Value) / Useful Life
  • API call example: Downloading regional property data from data provider API

Creating a Code Task

You can create Code Tasks in an existing workflow where you already have form fields created, or in a new workflow that you start from scratch.

If you’re starting from scratch, consider which input and output form fields you might want to include as part of your Code Task.

In your workflow click the + button at the end of the task list to add a Code Task.

Add a code task to your workflow

Using a preset example

Click the dropdown shown in the image below to select a prebuilt function.

Selecting a preset

  • Math formula – Calculate the total cost of a purchase
  • Extract data – Extract domains from email addresses
  • Unique ID generation – Generate a unique ID for records or tasks
  • Currency conversion – Convert one currency to another
  • Task priority – Set task priority based on the due date
  • Risk assessment – Assign a risk score based on predefined criteria
  • Process Street Public API call – Fetch data from Process Street’s API

Under the Input data section, click + Add value to add more input fields, or use the trash can to delete the ones you don’t need.

Where to add or remove inputs

These values can be manually entered or pulled from previous workflow tasks as variables. A manually entered value for the API call would be your API key, for example.

Input form fields you can use are:

  • Short text field
  • Long text field
  • Date field
  • Number field
  • Dropdown field
  • Linked dropdowns (linked to Data Sets)
  • Multi-choice field
  • Hidden field

Output form fields you can use are:

  • Short text field
  • Long text field
  • Number field
  • Hidden field
  • Send email widget

Note: In workflow view mode, other users won’t see API keys or other static values in your input fields unless they have edit permission on the workflow or they are an admin.

Generate code using AI

Click Generate with AI to let our Process AI wizard create the code for you.

Let Process AI dod the hard work for you

Simply write a prompt and the Code Task looks at your existing input and output form fields and adds these in for you, ready for testing.

Create custom code

If you’re already familiar with JavaScript and don’t need presets or AI generation, you can write and execute fully custom JavaScript logic.

Input fields can be accessed by reading keys of the inputData variable and 0utput fields can be written by setting keys of the ouputData variable.

Example: The Code Task has an input called “Customer Name” and an output called “Address”. They can be accessed in the following way:

const customerName = inputData[“Customer Name”]
outputData[“Address”] = “599 Broadway, New York, 10012”

Test your Code Task

When you’re done setting up your inputs, outputs and code, you can go ahead and test it.

Testing your code task

  • Click Test in the top-right corner of your Code Task
  • Enter test values in the input fields
  • Click Run code to see the calculated results under Output data
  • Validate your results by ensuring the calculations match expectations. Adjust the code or input variables if necessary

At this point you can go ahead and preview the Code Task in the editor, or publish it ready to be used.

Execution Constraints

  • Execution Time Limit: 5 seconds maximum per execution
  • Memory Limit: 128 MB maximum
  • Throttling: There’s no special throttling or rate limiting
  • Execution Environment: Runs on Node.js 22 within AWS Cloud
  • Processing Limitations: Code execution is constrained by available resources and runtime limits to ensure consistent performance
  • Time Handling: Code Task executions follow UTC timezone
  • Javascript package imports: Not supported

Note: If you require longer than 5 seconds per execution, please contact our Support team or your Account Executive.

FAQ

What happens if my script exceeds the limits?

If a script exceeds execution time or memory limits, it will be terminated, and an error will be returned.

Can I make API calls within a Code Task?

Yes, but keep in mind the execution time limit (5 seconds) when making network requests.

What version of Node.js does Process Street use?

Code Tasks run on Node.js 22.

Are there any rate limits?

Currently, no rate limits apply.

Can I use third-party libraries?

At the moment, only native Javascript functions are supported – external libraries cannot be imported. See the list below for allowed globals.

How do I debug my Code Task?

Use the Test feature to run the code and review the output. Debugging logs can be added using console.log().

What timezone do Code Tasks use?

-All date/time operations in Code Tasks follow UTC timezone, regardless of account settings.

Where can I get support?

For advanced JavaScript issues, consult a developer.

Process Street provides support for how the Code Task processes code but does not debug user scripts.

Allowed globals for Code Tasks

All standard Javascript built-in objects are available (e.g. Math, Date, RegExp). Moreover, we have allowlisted the following Node.js globals:

“Blob”,
“Buffer”,
“console”,
“crypto”,
“fetch”,
“FormData”,
“Headers”,
“Request”,
“Response”,
“URL”,
“URLSearchParams”,
“clearInterval”,
“clearTimeout”,
“setInterval”,
“setTimeout”,
“structuredClone”

Discover Process Street

Use Process Street to make your team processes fun, fast and faultless. We'll help you transform your team's static checklists into powerful interactive workflows!

Learn more about Process Street

YouTube videos
Deep dive into Process Street with our YouTube video series.
Join a webinar
Effectively record, replicate, and replace your workflow!
See latest releases
Catch up on the latest releases and enhancements.
Join the community
Share with others about how you are using the app day to day.

Take control of your workflows today.