What’s new in 4D 21 since 4D 20 R10

This document highlights all the new features introduced in 4D 21 LTS compared to 4D 20 R10. Each feature includes direct links to its blog post for practical examples and to the documentation for full technical details.

👉 If you missed the features introduced in 4D 20 R2 through R9, don’t miss the full list of key features added in each one—they’re linked at the bottom of this post under Feature Releases in Depth.

This document is divided into ten sections:

 AI Integration 

Additionally to the AI features introduced in earlier 4D 20 Rx versions—such as 4D AIKit for simplified communication with cloud-based or locally hosted AI models, and the introduction of native vector fields—4D 21 LTS goes a step further with new capabilities that make AI more practical, more integrated, and directly usable in business applications.

SEMANTIC QUERIES

You can now integrate semantic search directly into your ORDA queries. Instead of relying on separate processes, you can compare a record’s vector field against a reference vector and instantly return the most relevant results, all within the same ORDA grammar you already use.

The query accepts a simple parameter object with a required vector and optional attributes such as the similarity metric (which defaults to cosine) and a similarity threshold.

// Step 1: Define the kind of profile you want to match semantically
$searchText:="senior project manager with strong HR background, based in France"

// Step 2: Create an AI client (local baseURL optional)
$client:=cs.AIKit.OpenAI.new()
$client.baseURL:="http://127.0.0.1:1234/v1"

// Step 3: Generate an embedding vector for the search text
$embedResult:=$client.embeddings.create($searchText; "text-embedding-mxbai-embed-large-v1")
$semanticVector:=$embedResult.vector

// Step 4: Build the semantic query object with similarity options
$semanticQuery:={vector: $semanticVector; metric: "cosine"; threshold: 0.4}

// Step 5: Run the query — combine semantic match with traditional filter
$results:=ds.Profiles.query("yearsOfExperience >= 5 & expertise >= :1"; $semanticQuery)

Vector conditions blend seamlessly with classic ORDA logic, so you can combine semantic similarity with traditional filters in a single query. By adjusting the threshold, results can shift from broad and noisy to narrow and precise, giving you meaningful, context-aware results without adding complexity. The entire process stays within the ORDA grammar you already know, keeping your queries clean, expressive, and easy to maintain.

AI Tool Calling and Response Format

AI tool calling and response formats extend 4D AIKit with the ability to integrate business-specific functions directly into AI-driven conversations. Tool calling allows you to expose selected functionality from your application—such as “list available product categories” or “get top selling products”—as callable tools. When an AI model determines that a tool is needed, 4D AIKit automatically routes the call to your registered 4D functions and integrates the result back into the response. This avoids the need to upload or retrain large datasets, while still enabling the AI to answer user queries with live, application-specific data. In practice, this means you can embed a chat assistant in your application, and when a user asks, “What are the top 10 best-selling products by category?”, the model can call your functions, retrieve real business data, and return the answer in natural language.

In addition, 4D AIKit now supports structured response formats, making integration with downstream processes more reliable. Besides plain text, responses can be requested as strict JSON objects or forced to comply with a JSON schema that you define. This is particularly useful when unstructured input from users needs to be transformed into predictable data, or when AI-generated content must flow into automated workflows without manual cleanup.

Together, semantic queries, tool calling, and structured response formats make AI in 4D not just a conversational layer, but a fully integrated system component—capable of retrieving relevant business data, applying logic securely inside your application, and delivering structured outputs that fit seamlessly into your workflows. And now, with AIKit open-sourced, you have full transparency and control—able to adapt, extend, and evolve it for your own business needs.

 NETWORK switching

The QUIC protocol, introduced in 4D 20 R2, brought faster, more resilient communication—especially in high-latency or lossy environments. With 4D 21 LTS, QUIC is now the recommended network layer, replacing ServerNet as the default and marking a major step forward for reliable, modern deployments.

Seamless Network Switching

With 4D 21, switching between network interfaces no longer interrupts your 4D Remote connection. Whether moving from Ethernet to Wi-Fi, changing adapters, or waking a laptop on a different network, the client now automatically re-establishes its session with 4D Server and continues execution without data loss. This is made possible by the QUIC protocol, which allows fast, reliable reconnections across changing network conditions.

Your workflow stays seamless: the execution context is preserved, and processes pick up right where they left off. On the server side, the client’s IP address updates in real time across the Administration dialog, diagnostic logs, and the Session attributes, ensuring full transparency for administrators. This makes 4D Remote far more robust in mobile environments where network conditions frequently change.

 ORDA

With 4D 20 R10, ORDA introduced Constructor for initializing entities and onTouch for tracking modifications, moving business logic closer to the data. In 4D 21 LTS, this evolution is completed with a full set of lifecycle events, giving developers precise control over every stage of an entity’s life.

New Entity Lifecycle Events

Entity operations now provide a complete set of lifecycle events—validateSave, saving, afterSave, validateDrop, dropping, and afterDrop—covering every stage of saving and dropping an entity across three distinct phases:

  • Before → Validate and block invalid operations immediately.

  • During → Apply business rules, sync logic, or logging in real time.

  • After → Run follow-up tasks, integrations, or notifications—regardless of the outcome.

In practice, this means input can be validated before persistence, logic can be executed while the operation is taking place, and outcomes can be handled once the process is finished.

Events can be implemented at both the attribute and entity level. Validation events stop operations immediately on error, while post-events always execute. 

By concentrating logic in ORDA dataclasses, entity behavior becomes self-contained and easier to maintain. Business rules are no longer hidden in triggers, applications remain consistent by design, and external integrations can connect directly through native event hooks. In ORDA projects, triggers are no longer needed—lifecycle events now give you the full power of ORDA in a cleaner, more maintainable way.

 4D Qodly Pro

4D Qodly Pro lets you extend your business application with modern browser-based interfaces—without writing a single line of HTML or JavaScript. Build responsive web forms using a visual drag-and-drop editor and connect them directly to your existing 4D business logic.

Starting with 4D 21 LTS, you can even embed Qodly Pro pages directly into your classic 4D forms using a Web Area. From the user’s perspective, it feels like one seamless interface—no separate windows, no extra licenses required. The embedded Qodly Pro page shares the same session and license as the 4D Remote client, keeping the experience both transparent and at no additional cost.

Sharing Sessions AND INTERACTIONS Between Client/Server applications and 4D Qodly Pro

In 4D 21, a 4D Remote session and its license can now be shared with a 4D Qodly Pro application displayed inside a Web Area of a Client/Server app. This means no extra license is consumed, and the same session context flows seamlessly between the desktop form and the 4D Qodly Pro page.

Authentication and privileges are preserved automatically, and session data can be passed to initialize the web page with context from the desktop—for example, showing details of the currently selected entity.

Alongside session sharing, new 4D Qodly Pro actions enable direct two-way interaction between 4D forms and 4D Qodly Pro pages. From a 4D Qodly Pro page, developers can call 4D functions through the $4d object, previously initialized with the WA SET CONTEXT command. Conversely, a 4D form can update Qodly sources directly, ensuring synchronized state and logic across both environments.

Together, these enhancements make it easy to combine classic 4D forms with modern 4D Qodly Pro pages in a single application—unifying sessions, interactions, and context while avoiding redundant logins, extra licenses, or complex integration work.

Built-in Internationalization (i18n)

4D Qodly Pro now offers built-in internationalization (i18n), so your applications can adapt seamlessly to multiple languages and regional settings.

Supported languages are defined as locales in the new Localization section, where translation keys and values can be managed and bound to components. Language choice is handled by the built-in UserLanguage QodlySource, applying the user’s selection in real time.

Automatic fallbacks cover session data, browser defaults, or a primary locale, while native right-to-left (RTL) support makes languages like Arabic feel natural. Switching languages updates content instantly, creating a smooth, personalized experience.

This enables you to expand into new markets, reduce onboarding friction, and strengthen user trust—without redesigning your UI or adding complexity. Whether launching locally or globally, your product is ready to speak your users’ language.

Qodly page Events Report

The new Qodly Page Events Report in 4D Qodly Pro gives you a clear, unified view of all events on your page—whether they come from standard actions, navigation actions, class functions, or dialog actions. It shows which events are declared, where they’re implemented, and the exact order in which they execute.

By making event flow transparent, it speeds up debugging, uncovers overlaps or missing handlers instantly, and makes optimization straightforward. Teams can collaborate more easily, and you gain confidence knowing exactly how your page behaves.

It’s a simple way to bring clarity, accuracy, and efficiency to event management—whether you’re building a small app or a large-scale solution.

CANVAS ZOOM CONTROLS

4D Qodly Pro pages editor introduces canvas zoom controls to make working with complex layouts easier. Developers can now zoom in, zoom out, or reset the view directly from the toolbar, with support for keyboard shortcuts and mouse wheel navigation.

The current zoom level is displayed in the interface, giving developers precise control over how they view and arrange components on the canvas.

These enhancements improve navigation, design accuracy, and overall usability, aligning the pages editor with the standards of modern visual design tools.

Automatic Qodly Studio Setup

Launching Qodly Studio for the first time from 4D Design mode now triggers an automatic setup wizard. Any required settings—REST server activation, scalable sessions, web server ports—are detected and presented with a prompt to enable them.

If accepted, services restart as needed and Qodly Studio opens in the browser. If declined, no changes occur. The workflow is smooth, fast, and hands-free for new users.

Starting Qodly Studio no longer requires manual preconfiguration. First-time developers are productive in one click.

 4D Component

Usage of components has drastically improved between 4D 20 and 21. With the Dependency Manager, you can now easily add and maintain components—whether public or private. And starting with 4D 20 R10, a new model of component editing was introduced, allowing you to edit and debug component methods directly from the host project.

TOWARDS SEAMLESS COMPONENT INTEGRATION

Component development in 4D has taken a major step forward. Methods and classes from a component—whether shared or not—can now be viewed and edited directly in the host project, without having to open the component separately or break focus during development. All methods can now be edited on the spot, and entire components can be created from the host UI, initialized with namespace, files, and structure, then edited immediately in interpreted mode.

Beyond code, visibility has expanded to include read-only forms, folders, constants, commands, plug-ins, and even a component-specific Trash. Constants maintain linkage to their source components, ensuring consistency across the app, while new creation flows automatically wire dependencies and set up structure for both managed and legacy modes.

Altogether, this makes component iteration faster, modularization smoother, and projects cleaner and more transparent. It’s a significant milestone in bringing components closer to the host project workflow—while further improvements are still on the roadmap.

OPTIONAL COMPONENT MANAGEMENT

4D 21 no longer include standard 4D components. Instead, you declare your need for them through the Add Dependency dialog, and 4D automatically fetches and installs them on demand. From there, you can directly access the complete catalog of 4D components — including 4D AI Kit, 4D NetKit, 4D View Pro, SVG, and more — all published as open source on GitHub. This gives you the flexibility to install only what you need while also making it easier to explore component internals, contribute improvements, and align your projects with evolving needs.

  • Focused dependencies: Only required components are installed.

  • Version alignment: Dependencies follow your current 4D version by default, ensuring compatibility without manual checks.

When upgrading to 4D 21, existing projects can automatically download the required components, while binary databases continue to access them through the installer or the download portal.

 4D Netkit

While 4D NetKit initially focused on adding native Microsoft 365 and Google integrations—covering services like email and calendars—it has steadily evolved into a deeper toolbox for modern authentication and security. Today, it not only enables Single Sign-On through Microsoft 365, but also provides full OpenID Connect support for integration with a wide range of identity providers.

Custom URLs for Authentication Outcomes

The authenticationPage and authenticationErrorPage attributes in the cs.NetKit.OAuth2Provider.new() command now support full URLs in addition to static file paths. Authentication flows are no longer tied to local HTML files, and can redirect to dynamic pages hosted in any environment—4D Qodly Pro, your own server, or third-party services.

Custom success and error pages enhance flexibility while preserving your existing infrastructure. URLs can be updated independently of the app, reflecting new UX or branding with no rebuilds required. Supporting both URLs and file paths ensures backward compatibility while enabling more dynamic, integrated login flows.

OpenID with State and Nonce Handling

Authentication flows now fully comply with OpenID Connect through support for the state and nonce parameters.

  • state lets your app track context across redirects and validate it on return.

  • nonce guards against replay attacks by enforcing token uniqueness.

These parameters are automatically handled within NetKit, protecting against tampering and injection without additional implementation. 

Developers now integrate with modern identity providers—Google, Microsoft, Okta—confident that the security model holds under scrutiny, without having to build custom token validation layers.

 HTTP SERVER

The HTTP server in 4D continues to grow beyond simple request handling. With 4D 21, you gain centralized control of HTTP response headers and rules directly at the framework level—covering redirection, custom headers, caching policies, CORS, and more—removing the need for reverse proxies or manual header management.

custom http response rules

HTTP response headers in 4D are now configurable at the server level. Using a new HTTPRules.json file or the settings.rules parameter during startup, developers can define response rules matched by URL pattern. Supported rules include:

  • removedHeaders: strip unwanted headers (e.g., remove the Server header for stricter audits).

  • addedHeaders: inject security headers like Content-Security-Policy, X-Frame-Options, or Permissions-Policy.

  • denyAccess: block access to sensitive paths with a 403 status.

  • redirection: route requests for images, CSS, or JavaScript to a CDN.

  • status: explicitly define the response status code.

By handling headers directly within 4D, infrastructure becomes leaner, with far less reliance on external reverse proxies or manual header injection. Consistency improves, and policies are enforced at the framework level for all web responses—including REST.

security

The Feature Releases after 4D 20 introduced new TCP and UDP classes, replacing the legacy 4D Internet Commands. With 4D 21 LTS, this transition is completed by adding native TLS/SSL encryption, making secure low-level communication a built-in standard.

Secure TCP communications with built-in TLS/SSL support

TCP connections now support TLS/SSL encryption natively. By setting the TLS attribute in the new options parameter of 4D.TCPConnection.new(), you create encrypted sessions without extra configuration or wrappers.

  • Standard and secure ports can run in parallel.

  • Once the handshake completes, encrypted messages flow seamlessly over the connection.

  • TLS 1.3 is the default protocol, ensuring high security and compatibility with modern endpoints.

This means sensitive data is protected by design, compliance is easier to achieve, and secure messaging is no longer a workaround—it’s the standard.

Use Windows Certificate Store Instead of Local Files

HTTPS requests can now pull certificates directly from the Windows keychain using the storeCertificateName parameter in the HTTPRequest and HTTPAgent class. This eliminates the need to store and manage certificate files locally.

System-level protection and centralized management replace manual file juggling. Certificate handling becomes more secure, consistent, and easier to administer across teams and machines.

Unified Session Management for REST and 4DACTION

With 4D 21, you now have a comprehensive way to inspect all open web sessions, whether they originate from REST connections, SOAP calls, or 4DACTION requests.

  • All active sessions are listed in real time, giving administrators a transparent view of activity and resource usage.

  • Sessions can be labeled with usernames via Session.setPrivilege(), making it easy to identify connected users, trace actions, and manage licenses.

  • Sessions are thread-safe and automatically optimized, ensuring efficient resource use and reliable performance even under heavy load.

This provides smoother API execution at scale while giving developers and administrators clearer monitoring, stronger auditing, and improved stability.

Core Library and Dependency Upgrades

With 4D 21 LTS, we’ve upgraded Xerces, libldap, ICU, Chromium (CEF), OpenSSL, libZip, LZMA, ZLib, Libuv, BoringSSL, and PDFWriter—modernizing the entire stack to strengthen security, improve stability, and ensure compatibility with today’s platforms.

 4D language

The difference in the 4D programming language between 4D 20 and 4D 21 is huge—too big to summarize in just a few lines. Over the course of the Feature Releases, the language has gained modern syntax, stronger typing, better error handling, and new commands. With 4D 21 LTS, more improvements continue to make coding simpler and more consistent.

Hexadecimal String to Number Conversion

The String command now lets you convert hexadecimal strings directly into numbers. No more writing parsing utilities or dealing with binary string tricks. Just pass the string, and you get the numeric result.

It’s a subtle addition that removes friction when working with external APIs, low-level formats, or integrations returning hex.

New String Trim Functions

New commands—trim, trimStart, trimEnd—make it easier to strip whitespace or specific characters from strings. They behave like their JavaScript or Python equivalents and work with any character set.

Manual trim logic is no longer necessary. Data is cleaner, form inputs are easier to validate, and code aligns with expectations across modern languages.

 Licenses

Licensing in 4D is now smarter and more automated. With 4D 21, developer licenses are automatically retrieved and activated when you sign in, eliminating the manual steps that previously slowed down renewals or setups.

AUTOMATIC RETRIEVAL OF partner DEVELOPER LICENSEs 

4D now automatically fetches and activates your partner developer license whenever it changes, removing the need to manually re-enter license numbers on each machine. When you sign in, 4D checks your Partner Program account through 4D Motor, detects any available Developer or Developer Pro license for your platform, and registers it instantly. If only one license is available, activation happens automatically; if several are found, you’re prompted to choose which one to use.