Ask AI
Skip to main content

Get template ui element by code

Function: Get template UI element by code

This action allows you to retrieve a specific UI element from your current template by using its unique code. This is useful when you need to dynamically access or manipulate a part of your template, such as updating its content or visibility based on user interactions or data.

Input

  • Code: (Text) The unique identifier for the UI element you want to find within your template. This input is required.

Output

  • UI element: (UI element) The retrieved UI element will be stored in a variable with this name. By default, it will be named TEMPLATE_COMPONENT, but you can change it to a more descriptive name if needed. This output is required.

Execution Flow

Real-Life Examples

  1. Example: Dynamically showing a welcome message

    • Scenario: You have a welcome message UI element (welcomeMessage) in your template that should only appear if a user is logged in. You need to retrieve this element to change its visibility.
    • Inputs:
      • Code: welcomeMessage
    • Result: The welcomeMessage UI element is retrieved and stored in a variable named TEMPLATE_COMPONENT. You can then use another action to set its visibility to true if the user is logged in.
  2. Example: Updating a product description field

    • Scenario: On a product detail page, you want to update the text content of a specific product description field (productDescriptionText) after fetching new data from a database.
    • Inputs:
      • Code: productDescriptionText
    • Result: The productDescriptionText UI element is retrieved and stored in a variable named TEMPLATE_COMPONENT. You can then use another action to update its text content with the new product description.
  3. Example: Highlighting an active navigation item

    • Scenario: You have a navigation menu where each item has a unique code (e.g., navHome, navAbout, navContact). When a user clicks on a menu item, you want to retrieve that specific item and apply a "highlighted" style.
    • Inputs:
      • Code: navAbout (assuming the user clicked the "About" link)
    • Result: The navAbout UI element is retrieved and stored in a variable named TEMPLATE_COMPONENT. You can then use another action to add a CSS class or change its properties to highlight it.