Back to Blog

Dynamic Action Mechanism of lcdp.ai Low Code Development Platform

A comprehensive guide to create Dynamic Action within the LCDP.ai low-code development platform.

Posted by

Key Features of Version 0.28 of LCDP.ai Low-Code Development Platform

Introduction to the Core of Our Rapid Application Development Platform: Dynamic Actions

Dynamic Actions are a pivotal feature of any Rapid Application Development Platform, offering unparalleled flexibility and efficiency in customizing workflows and automating tasks.
This capability is essential for developers and system administrators who need to adapt and extend the functionality of their applications quickly without deep dives into complex code modifications.

What are Dynamic Actions?

Dynamic Actions enable users to define and implement custom operations within an application with minimal coding. These actions can be configured directly through the user interface or imported via CSV, accommodating both technical and non-technical users.
Furthermore, these actions can leverage advanced execution engines, including Large Language Models (LLM) AI, enhancing their ability to process complex data and interact intelligently with other systems.

Key Benefits

  • Flexibility: Users can create actions that trigger a wide range of operations, from simple data modifications to complex business logic and AI-driven interactions.
  • Efficiency: Reduces the need for repetitive coding tasks by allowing reusable actions across different parts of the application.
  • Innovation: Integrating LLM AI as an execution engine enables cutting-edge capabilities, such as natural language processing and predictive analytics within actions.
  • User Empowerment: Enables a broader range of users to contribute to application development and maintenance, aligning with the principles of user-centered design in rapid development environments.

Dynamic Actions represent a core tool in the Rapid Application Development Platform, empowering users to efficiently manage and evolve their applications in response to changing business landscapes. In the following sections, we will explore how these actions can be configured and utilized across various scenarios to maximize productivity and effectiveness.
Dynamic action properties illstrate on below screenshot.

Dynamic class actions on LCDP.ai low code development platform

  • Name: name of the dynamic action, should be unique acoress current tenant
  • Label: label of the dynamic action, will be displaed on UI, can be translated
  • Help text: An optional help text display on UI when users mouse hover the action button
  • Icon: Icon displayed on UI together with the label
  • Enable logic: an logic to decide whether to show this action button at runtime dynamically
  • Core logic: core logic of the action, the main logic to be executed when user click the action button
  • Mode: action mode, single object, multiple object or class level, decides under which scenario will the action button be shown
  • Enable async: whether the action is async or not, if async, the action will be executed in background, and a system message will be send out when action runs completed
  • Confirm type: the type of confirmation message to be shown when user click the action run button
  • Support fine tuning: whether the action support fine tuning after execution, if yes, user can adjust the result after the action is actually executed(mainly for LLM action)
  • Confirm message: the message to be shown when user click the action run button
  • Enable role: the role that can see the action button
  • Ext Info: extra information for the action, like whether to refresh the UI after action execution etc.

Understanding Action Modes

Action modes dictate the scope and application context within the platform, ensuring precise operational execution.
Below is the available action modes supported by dynamic actions on LCDP.ai low code development platform.

Different dynamic action mode on LCDP.ai low code development platform

Single Object Actions

Tailored for individual records, such actions allow for detailed adjustments or actions on specific entries.For example, updating the delivery status of a single parcel in a logistics application.

Here is a single object action example, when user select a record and click on the action button, the action will be executed on the selected record.

Multiple Objects Actions

Ideal for batch operations like merging records or updating multiple entries simultaneously.Imagine consolidating user profiles after identifying duplicates.

Class Level Actions

Class-level actions are not bound to individual or multiple objects but are associated with a domain type. They're accessible from the list header and are applicable when no specific records are selected.This can be seen in actions like creating a new object within a domain or importing a set of records from an external source.Dynamic class actions on LCDP.ai low code development platform

User Interaction and Confirmation Modes

The way users interact with Dynamic Actions can vary depending on the need for confirmation or immediate execution. These modes ensure that actions are executed with the necessary user input or automatically to streamline workflows. Below is the available confirmation modes supported y dynamic actions.Dynamic action confirmation type on LCDP.ai low code development platform

No Confirmation Actions(No message or confirm)

For swift and uninterrupted task execution, actions can be set to run without any user confirmation.An example is a script that cleans temporary files from the system, running silently in the background.

Pop-up Free Actions(No execution popup and no confirm)

Actions can execute immediately upon user initiation without pop-up interruptions, followed by an automatic refresh of the action list.Imagine a user updating their profile information, with changes reflected instantly without additional prompts.

Display Confirmation Actions

When important or irreversible operations are involved, requiring user confirmation helps prevent accidental changes.For example, confirming the deletion of a record provides an extra layer of security against data loss.

Support for Result Fine-Tuning

In the realm of Dynamic Actions, the ability to fine-tune the results post-execution is a sophisticated feature that caters to precision-driven processes. During the definition of an Action, it is possible to set whether the result can be adjusted after execution. This functionality is particularly useful when Dynamic Actions call upon large language models (LLMs) and require nuanced adjustments to the AI-generated outcomes.For instance, an Action could generate a customer response based on an AI model which can then be fine-tuned for tone or style before sending.

Core Features and System Integration

Association of Actions with Domains

Dynamic Actions can be associated with specific domains within the platform. This association determines the scope and accessibility of the Action, thereby ensuring it is presented in the appropriate context within the user interface.For example, an Action associated with the "Invoices" domain may appear as an option when managing financial records.

Variable Injection and Its Role in Every Action

A key element of Dynamic Actions is the system's ability to inject context-specific variables during execution, enabling actions to adapt dynamically to the situation at hand. The variables provided to the action include user context, application state, action definitions, and target domain object details.

For instance, when an action is run, the system automatically provides relevant information such as the current user's details, the list of domain object IDs (`objectIds`) targeted by the action, and even user-input parameters (`parameters`) if a dynamic form is used in the UI. This means actions are not only responsive to the direct context in which they are executed but also to the user's interaction with the system.

Dynamic Actions are customized by injecting context-specific variables at runtime, providing powerful and flexible behavior tailored to the current operational context.

Variable NameTypeDescription
userContextGrailsUserInformation about the current user
applicationGrailsApplicationThe current Grails application context
actionDynamicActionThe definition of the running action
objectIdsList<Long>List of target domain object IDs
objectsList<? extends GormEntity>List of target domain objects
objectTypeDomainClassType information of the target domain object
parametersMap<String, Object>Parameters input by the user for the action (only available to core Logic)
ownerInfoOwnerInfoInformation about the primary object associated with the current list
logClosure<?>Closure used for logging execution details

Take, for example, displaying an Order's item list. The `ownerInfo` will contain the ID and class type of the Order, linking each item back to its parent context. This becomes crucial when actions are designed to work within a specific domain, ensuring that they behave consistently and correctly, regardless of the complexity of the operation.

It's also important to note that while `parameters` are injected only during core logic execution for user-driven actions, they're not included during the enable logic phase since this phase is about assessing action availability without needing user input.

This injection mechanism ensures that developers can create highly responsive and intelligent actions, capable of operating with precision across a wide range of scenarios within the Rapid Application Development Platform.

Execution and Result Handling

Dynamic Actions are engineered to report back on their execution with comprehensive result handling. Whether the action completes successfully, encounters warnings, or fails, the system captures this information. Moreover, actions have enabling logic to determine their availability based on the current context, and post-execution logic to process outcomes, such as triggering notifications or executing follow-up steps.

For example, an action that performs data migration will have detailed logs of each step, and any issues encountered will be reported for troubleshooting. This level of feedback is crucial for maintaining high standards of data integrity and operational transparency.

Result Handling and Enabling Logic

The system provides a structured approach to handle the results of an Action. Whether an Action completes successfully, with warnings, or fails, there are defined protocols for each scenario. Additionally, enabling logic can be defined to control when an Action should be available, adding a layer of dynamic visibility and access control.Consider an Action that archives completed projects; enabling logic ensures it's only visible when applicable projects are selected.
Enable logic should return follow structure to the platform

[result: true | false]

Real-World Scenarios

Single Action Example: Shipping an Order

Imagine an e-commerce platform where each order triggers a Dynamic Action to manage the shipping process. The action automates the validation of the shipping address, calculates shipping costs based on location, prepares the invoice, and updates the order status to 'shipped'. This process ensures that all steps are taken care of in a single, streamlined action, significantly improving operational efficiency.

Multiple Action Example: Merging Customer Records

In CRM systems, Dynamic Actions are used to merge customer records. This action is crucial when two records are identified as duplicates, allowing for the consolidation of contact information, historical purchases, and support tickets into a single, unified customer profile, eliminating data redundancy and improving customer management.

Class Level Action Example: Bulk Updating User Roles

A common administrative task is updating user permissions en masse. A class-level Dynamic Action could be configured to elevate user privileges across the board, such as upgrading all 'user' roles to 'admin' within certain conditions. This action is presented at the domain level and executed without the need to select individual user records.

Execution and Result Handling

Detailed Execution Flow

Dynamic Actions are designed to follow a systematic execution flow that ensures each step is completed accurately. From initialization to completion, every action is monitored for efficiency and effectiveness. For more details on Dynamic Actions, see the documentation.

The execution result returned from a DynamicAction core logic is in the following format:

execResult String 
redirect String
Download: string
[
  execResult: "The execution result"
  redirect: "The redirect page after execution, if needed",
  download: "An optional download attachment, if needed" //of type tech.muyan.storage.StorageFieldValue
]

Handling Different Execution States

Actions may end with different statuses, such as 'Not Started', 'Running', 'Success', 'Failed', and 'Success with Warning'. The system appropriately logs these states, offering developers and administrators clear insights into the action's performance.

Communicating Results to Users and Systems

The platform ensures that the results of each action are effectively communicated back to the users or other systems. This includes real-time updates and comprehensive logs, which are crucial for maintaining transparency and accountability in a Rapid Application Development Platform. Further information can be found in the Dynamic Logic section of our documentation.

Extend Information (eg the extInfo column)

Support extInfo

ExtInfo is some extra information, which is supported by our LCDP.ai low code development platform. Built in extInfo includes
{
Display text label on UI, default to true, set to false to only display icon
"displayLabel" : true | false,
Refresh page after action execution, default to true, set to false to avoid refresh page
"refreshPage" : true | false
}

Conclusion

Summary of Benefits

Dynamic Actions streamline application development and operations, enhancing flexibility, efficiency, and user empowerment. These features are pivotal in adapting quickly to evolving business needs within a Rapid Application Development Platform.

Final Thoughts on Implementing Dynamic Actions

Implementing Dynamic Actions represents a strategic advantage for businesses seeking to leverage automation and advanced data processing capabilities. They are a cornerstone of innovation in application development, ensuring that businesses remain agile and responsive in today’s fast-paced market environments.

Futher discusstion

Online Community

Please join our low code development community on community.lcdp.ai to discuss more about dynamic actions and other low code development topics.

Tweet

You can find us on Twitter at LCDP.ai to share your thoughts on dynamic actions and other low code development topics.