Ask AI
Skip to main content

Execute action

Function: Execute action

This function allows you to run another pre-defined action from within your current action or workflow. It's like calling a sub-routine or a modular piece of logic, enabling you to reuse common processes and build more complex applications by combining smaller, focused actions.

Input

  • Action:
    • Description: The specific action you want to execute. This could be any action available in your platform, such as updating a database record, sending an email, or calling an external service.
    • Type: Action (a piece of logic that can be executed)
    • Required: Yes
  • Action parameters:
    • Description: Any specific values or settings that the action you are executing needs to perform its task. For example, if you're executing an "Update Customer" action, the parameters might include the Customer ID and the new status.
    • Type: Action Parameters (parameters passed to actions)
    • Required: No
  • Mode:
    • Description: Determines how the platform should handle the execution of the selected action relative to your current workflow.
    • Type: Selection (dropdown with predefined options)
    • Options:
      • Default \(runs synchronously\): Your current action will pause and wait for the executed action to complete before continuing.
      • Asynchronous execution: Your current action will immediately continue to the next step without waiting for the executed action to finish. The executed action runs in the background.
      • Asynchronous with frontend answer: Your current action will continue, and the executed action runs in the background. If the executed action generates any user interface updates or messages, they will be sent back to the user.
    • Default: Default \(runs synchronously\)
    • Required: No
  • Cache results:
    • Description: If set to True, the platform will temporarily store the results of the executed action. If the same action is called again with the exact same input parameters within the specified cache duration, the platform will use the stored results instead of running the action again, saving time and resources.
    • Type: True/False
    • Default: False
    • Required: No
  • Cache TTL:
    • Description: The duration (in milliseconds) for which the action's output should be kept in the cache. This setting is only relevant if 'Cache results' is set to 'True'. For example, 60000 milliseconds equals 1 minute.
    • Type: Number (an integer representing milliseconds)
    • Default: 60000
    • Required: No (This parameter only appears if 'Cache results' is set to 'True')

Output

  • Action outputs:
    • Description: The results, data, or status information generated by the action that was executed. These outputs can then be used in subsequent steps of your current workflow.
    • Type: Action Outputs (where outputs generated by the action are defined)

Execution Flow

Real-Life Examples

Example 1: Automating Customer Welcome Email

Scenario: After a new customer signs up, you want to automatically send them a personalized welcome email. You have a separate action called "Send Welcome Email" that handles the email content and sending logic.

  • Inputs:
    • Action: "Send Welcome Email"
    • Action parameters:
    • Mode: Default \(runs synchronously\)
    • Cache results: False
  • Result: The "Send Welcome Email" action is executed immediately, sending a welcome email to John Doe. Your current workflow waits for the email to be sent before proceeding to the next step (e.g., updating the customer record as "welcomed").

Example 2: Generating a Large Report in the Background

Scenario: A user requests a comprehensive monthly sales report, which takes a long time to generate. You don't want the user to wait, so you want to start the report generation process in the background.

  • Inputs:
    • Action: "Generate Monthly Sales Report"
    • Action parameters:
    • Mode: Asynchronous execution
    • Cache results: False
  • Result: The "Generate Monthly Sales Report" action starts running in the background. Your current workflow immediately continues, allowing the user to interact with the application without waiting. Once the report is ready, it will be emailed to [email protected].

Example 3: Displaying Product Inventory with Caching

Scenario: Your e-commerce website frequently displays product inventory levels. Fetching this data from the backend can be slow, but the inventory doesn't change every second. You want to display up-to-date information but also improve performance by caching.

  • Inputs:
    • Action: "Get Product Inventory"
    • Action parameters:
      • ProductID: "P12345"
    • Mode: Default \(runs synchronously\)
    • Cache results: True
    • Cache TTL: 300000 (5 minutes)
  • Result:
    • First Execution: The "Get Product Inventory" action runs, fetches the inventory for "P12345", and makes the output available. The results are stored in the cache for 5 minutes.
    • Subsequent Executions (within 5 minutes): If "Get Product Inventory" is called again with ProductID: "P12345", the platform retrieves the inventory directly from the cache without running the backend action, providing a faster response.
    • After 5 minutes: If called again, the cache will have expired, and the action will execute again to fetch fresh data, then re-cache the new results.