Skip to main content

Custom Code Control

Add a Custom Code control to a Yeeflow form or dashboard, map its inputs, and use Preview to verify the result.

Use the Custom Code control to render a component in an approval form, list form, or dashboard. Map its inputs to fields or values and test it in the target form or dashboard. To run code when a form action is triggered, add an Execute custom code step to the form action.

You can:

  • Build custom UI components (e.g., calendar, dashboards)

  • Execute business logic and calculations

  • Transform mapped form or list values for display

  • Use AI Builder to generate and refine code with natural language


Overview

The Custom Code control supports two main approaches:

  • AI-assisted development (Recommended) — generate and refine code using AI Builder

  • Manual scripting — paste or write code directly and configure parameters

Use the AI code editor to draft and refine a component, or paste a component built for the Yeeflow runtime into the control settings.


Control Settings

When you add a Custom Code control to a form or page, the following settings are available:

The Custom Code Content panel has a script field and a Code editor button.

Content

  • Enter or paste JavaScript code directly

  • Used for quick scripting or prebuilt components

Code editor

  • Opens the full-screen development environment

  • Includes AI-assisted drafting, source editing, and a rendered preview

Input parameters

  • Appears when the component declares input parameters

  • Used to pass values into the script


How It Works

Step 1: Add Custom Code Control

  1. Open your form or page in the designer

  2. From Advanced, drag the Custom Code control onto the canvas.


Step 2: Choose How to Build the Logic

You can build your logic in two ways:

  • Option A: Paste or write code directly

  • Option B: Use AI Builder (Recommended)


Option A: Paste or Write a Script Directly

Use a component written for the Yeeflow form or dashboard runtime. Follow the Custom Code getting-started guide for the component entry point and supported runtime patterns.

Step 3A: Enter or Paste Code

Paste the compiled JavaScript for the control in Content. If you built it locally with TypeScript or TSX, follow the Yeeflow build instructions and copy the JavaScript output for that component.

Review the code and its dependencies before adding it. Use example data when testing and keep credentials out of the component.

Step 4A: Configure Input Parameters (If Available)

When your script includes predefined inputs, the system will automatically generate an Input parameters section.

Map each parameter to the value or field the component expects. Check field types and how the component behaves when a value is empty.

Example: Calendar Component

A calendar component can declare inputs like the ones below. The names come from that script.

Example calendar input labels include appId, listId, titleField, startField, endField, timezone and initialView.

  • appId / listId – data source identification

  • titleField – event title

  • startField / endField – event time range

  • descriptionField – event description

  • colorField – event color mapping

  • allDayField – all-day event flag

  • timezone – display timezone

  • initialView – default view (day/week/month/year)

  • refreshMinutes – auto refresh interval

Use a representative test list and an empty list to check the mapped title, dates, and default view. A calendar preview with no events checks the layout. A populated test list checks the field mapping.

Step 5A: Preview the Result

  1. Click the Preview tab

  2. Review the result with populated and empty inputs, then preview the form or dashboard that contains the control.

  • If the code includes UI → it will be displayed

  • If the preview reports no visual output, check that the control implements its render entry point and that the required inputs are present.


Option B: Use AI code editor to Generate Code (Recommended)

If your control offers the AI code editor, use it to draft a component from a description and refine it with follow-up prompts.

Start with a small example and use synthetic values while you test how the component renders.

Step 3B: Open the Code Editor

  1. Click Code editor in the control settings

  2. The interface switches to a full-screen editor

Step 4B: Understand the Editor Layout

The editor consists of three main areas:

1. AI Builder Panel (Left)

  • Conversational interface for generating code

  • Supports iterative refinement

2. Code Editor & Preview (Center)

  • Code (Source TS/JS): edit or view code

  • Preview: view rendered UI output

3. Configuration (Right)

  • Input variables

Step 5B: Generate Code with AI code editor

  1. In AI code editor, describe the component, the mapped inputs, and the result you expect. For example, create a project summary card with example counts for total, completed, and pending tasks.

Example use cases:

  • Build a dashboard with summary cards, a data table, and a chart

  • Create a calendar view based on a Yeeflow list

  • Display a project summary with key metrics

  • Calculate values based on input fields

  1. Submit the prompt to generate code.

  2. Review the code and check that its dependencies and React features are supported in the target runtime.

  3. Open Preview and compare the rendered result with the expected output. Then test the actual field mappings in the target form or dashboard.

Refine the Result with Follow-Up Prompts

After the initial result is generated, you can continue refining it by asking AI Builder to:

The rendered Project Summary card displays 128 total tasks, 96 completed and 32 pending.

  • Adjust layout and spacing

  • Improve visual styling (cards, colors, alignment)

  • Add or modify components (e.g., table, chart, additional cards)

  • Fix data or rendering issues

  • Adapt the structure to your specific use case

Step 6B: Apply the Code

After validation:

  1. Click Save

  2. Click Save & Exit

Step 7B: Unsaved Changes

If you exit without saving:

A confirmation dialog appears:

The Unsaved Changes dialog shows options to save and exit or discard changes.

  • Save & Exit

  • Discard changes


Example Use Cases

1. Calendar View

  • Display events from a Yeeflow list

  • Support multiple time views (day/week/month/year)

2. Data Calculation

  • Compute totals, tax, or derived values

3. Custom UI Components

  • Dashboards

  • Summary panels

  • Interactive widgets


Best Practices

  • Use a supported component and test with the permissions of the roles that will use it.

  • In a read-only view, check that the control displays existing values and respects editing permissions. See Custom Code Controls for read-only and output handling.

  • If the control writes an output, test the configured field or variable. For values intended to persist, save through the host and reopen the record to verify the result.

  • Check empty input and rendering errors before publishing. Previewing the interface and verifying saved data are separate checks.


Summary

The Custom Code control provides a flexible way to extend Yeeflow with both AI-powered development and manual scripting.

  • Use AI Builder for speed and ease of use

  • Use manual scripting for precise control

  • Combine both for the best results

Did this answer your question?