Alpha

Build and run processes with code

Write custom JavaScript or generate functions with AI. Connect data, apply business rules, and orchestrate your processes with code.

Function
Code
  1. import { inputs, queries, type FunctionResult } from "@budibase/functions"
  2.  
  3. export default async function (): Promise<FunctionResult> {
  4. const { workOrderId, partNumber, requestedQuantity } = inputs
  5.  
  6. if (!workOrderId || !partNumber || !requestedQuantity || requestedQuantity <= 0) {
  7. return { output: { status: "invalid_request" } }
  8. }
  9.  
  10. const order = await queries.Maintenance.getWorkOrder({ workOrderId })
  11. const stock = await queries.Inventory.getPartStock({ partNumber })
  12. const available = stock.data[0]?.availableQuantity ?? 0
  13.  
  14. return {
  15. output: {
  16. workOrder: order.data,
  17. availableQuantity: available,
  18. status: available >= requestedQuantity ? "in_stock" : "replenish",
  19. needsReview: inputs.safetyCritical || available < requestedQuantity,
  20. },
  21. }
  22. }
  23.  
Use {{ for shortcuts.
Arm
American Express
Saab
Austrian Patent Office
Pratt Miller
Northern Territory Government
Ericsson

Flexibility

Write JavaScript to transform data, apply business rules, and build the logic your processes need.

Generate functions with AI

Describe the logic you need, then review, refine, and test the generated code before putting it to work.

Works seamlessly with apps, automations and agents

Bring your custom logic into the apps, automations, and agents that power your processes.

Code that fits the way you work

Version your logic, troubleshoot with familiar tools, and run it when your process needs it.

Version your functions

Keep track of function versions as your business logic changes, with a clear history of your work.

Debug with your own AI assistant

Copy and paste your code into your preferred AI assistant to troubleshoot errors and refine your logic.

CRON, webhooks, data triggers, and more

Use functions in automations to benefit from scheduled runs, webhooks, data changes, and the other triggers your processes need.

You have questions. We have answers.

What can I build with functions?

Write JavaScript for the business rules, calculations, validation, and data transformations your processes need. Use functions within automations to add custom logic to a workflow.

Can AI generate a function for me?

Yes. Describe the logic you need and generate a function with AI. Review the code, adjust it to your requirements, and test it before using it in your process.

Can I version my functions?

Yes. Version your functions to keep track of changes as your logic evolves. Function versioning tracks your code changes within Budibase.

How can I get help debugging a function?

Copy your code and the relevant error into your preferred AI assistant. Use its suggestions to troubleshoot the issue, then review and test any changes in Budibase.

How do I trigger a function?

Add your function to an automation. The automation's trigger determines when it runs, including CRON schedules, webhooks, and data changes.

Contact sales

Interested in modernising processes with Budibase?

Enter a valid email address so our team can reply.

The security check will load when the form is visible.

Having trouble submitting? Email sales@budibase.com.