LogoLogo
HomepageYouTube ChannelInstall from the AppExchange
  • Home
  • Dynamic Components
  • Flow Components
  • Experience Components
  • Projects
  • 👋Welcome
  • Getting Started
    • Product Tour
    • Quickstart Tutorial
    • Avonni Components App
      • Accessing the App
      • Folders
      • Templates
      • Version management
    • Understanding The Essentials
      • Component Builder
      • Component Visibility
      • Target Page Object
      • Using Variables and Component Data
      • Publishing your Dynamic Components
      • Dynamic vs. Flow Components
    • AppExchange Listing Page
    • Installation & Licenses Management
  • Tutorials
    • Projects
    • Components
      • Calendar
        • How to Create Events Quickly by Dragging
        • How to Add an Edit Action to Calendar Events
        • How to Add a New Event Button to the Calendar Header
        • How to Customize the Right-Click Menu
        • How to Reschedule Events with Drag and Drop
      • Columns
        • Creating a Responsive 3-Column Layout
      • Data Table
        • How to customize Data Table style
        • How to make a field editable
        • How to add clickable buttons
        • How to color-code badges
        • How to export data
        • How to configure search
        • How to set columns visibility
        • How to Conditionally Color Data Table Cells
      • Kanban
        • Saving Changes on Drag-and-Drop
      • List
      • Metric
      • Record Detail
        • Saving Changes
    • Interactions
      • How to create an interaction to navigate to an object page
      • How to Toggle a Reply Panel Using Assignment Interaction
      • How to create an interaction to navigate to a record page
      • How to Pass Multiple Selected Records from a Dynamic Component to a Screen Flow
    • Reactive Components
      • Reactive Map and Data Table
      • Master-Detail Relationship with Data Tables
      • Vertical Tabs with Reactive Data Table
    • Style
      • How do you add space or a break between sections or fields?
    • Tips and Tricks
      • Using the Dynamic Component component
  • Component Builder
    • Overview
    • Configuring Components
      • Properties
      • Fields
      • Style
    • Data & Interactions
      • Data Sources
        • Manual
        • Picklist
      • Resources
        • Constant
        • Formula
        • Nested Queries
        • Query
        • Variable
      • Interactions
        • Assignment
        • CRUD from Record Variable
        • Download
        • Execute Flow
        • Navigate
        • On Load
        • Open Alert Modal
        • Open Confirm
        • Open Dynamic Component Dialog
        • Open Dynamic Component Panel
        • Open Flow Panel
        • Open Flow Dialog
        • Show Toast
        • Update Location
    • Advanced Features
      • Copy and Paste
      • Debug Panel
      • Keyboard Shortcut
      • Undo / Redo
  • Components
    • Explore All Components
    • Accordion
    • Alert
    • Audio Player
    • Avatar
    • Avatar Group
    • Badge
    • Barcode
    • Blockquote
    • Button
    • Button Group
    • Button Icon
    • Button Menu
    • Button Stateful
    • Calendar
    • Camera
    • Card
    • Carousel
    • Chart
    • Checkbox
    • Checkbox Button
    • Chip Container
    • Color Picker
    • Columns
    • Combobox
    • Container
    • Counter
    • Data LWC Container
    • Data Table
    • Date Picker
    • Date
    • Date Range
    • Dual Listbox
    • Dynamic Component
    • File Upload
    • Flow
    • Formatted Address
    • Formatted Name
    • Formatted Value
    • Header
    • Icon
    • Icon Picker
    • Illustration
    • Image
    • Input Color
    • Input Date
    • Input Pen (Signature)
    • Input Text
    • Kanban
    • List
    • LWC Container
    • Map
    • Media Object
    • Metric
    • PDF Viewer
    • Pivot Table
    • Progress Bar
    • Progress Circle
    • Progress Indicator
    • Rating
    • Record Detail
    • Relationship Graph
    • Scope Notification
    • Section
    • Separator
    • Slider
    • Status
    • Tabbed Container
    • Tabs
    • Text
    • Text Area
    • Timeline
    • Toggle
    • Tree
    • Vertical Visual Picker
    • Video Player
    • Visual Picker
    • Visual Picker Link
  • Help
    • Contact Support
    • Security
    • Performance Guide
    • Deployment Process
    • Release Notes
    • Report Bugs
Powered by GitBook
LogoLogo

Company

  • About Us
  • Pricing

Policies

  • Privacy Policy
  • Terms of Service
On this page
  • Overview
  • Key Purpose
  • When to Use the Assignment Interaction
  • Configuration
  • Practical Example
  • Key Considerations
  • In Summary

Was this helpful?

  1. Component Builder
  2. Data & Interactions
  3. Interactions

Assignment

Overview

Think of the Assignment interaction as a command that says, "Take this variable and change its value in this specific way." While many input components (like Text Input or Toggle) can update a variable automatically through data binding, the Assignment interaction is used when you need to change a variable's value as a direct result of an action.

Key Purpose

  • State Management: Set a variable to control the state of your component (e.g., set isPanelVisible to true when a button is clicked).

  • Data Manipulation: Modify data stored in a variable (e.g., increment a number, add text to a string, or replace parts of a string).

  • Resetting Values: Easily clear user input or reset a component to its initial state.

When to Use the Assignment Interaction

  • Toggling Visibility: On a "Show/Hide Details" button, use Assignment to toggle a Boolean variable between true and false.

  • Dynamic Text Building: Concatenate (add) strings together in a variable in response to different user actions.

  • Data Cleanup: Use replace operators to format or clean up data stored in a variable before using it elsewhere.

Configuration

You add the Assignment interaction as an Action within another component's event (e.g., On Click, On Change).

  1. Select the Triggering Component: Choose the component (e.g., a Button) that will initiate the variable change.

  2. Access Interactions: In the Properties Panel, go to the Interactions section.

  3. Choose the Event: Select the event that should trigger the assignment (e.g., On Click).

  4. Add Action: Click "Add Action".

  5. Set Action Type: Select Assignment (or a similar name like "Set Variable Value").

  6. Configure the Assignment Properties:

    • Variable: (Resource - Essential) Select the target Variable resource whose value you want to change (e.g., {!myCounterVariable}, {!isDetailsVisible}). This variable must already exist in your Resources panel.

    • Operator: (Select) Choose how you want to modify the variable:

      • equal: Replaces the current value of the variable with a new one. This is the most common operator.

      • add: Adds to the existing value. Behavior depends on the data type:

        • For Numbers, it performs mathematical addition (e.g., 2 add 1 becomes 3).

        • For Text, it concatenates (appends) the text (e.g., "Hello" add " World" becomes "Hello World").

        • For Collections, it adds a new item to the list.

      • replace first occurrence: Finds the first instance of a specified string and replaces it.

      • replace all occurrences: Finds all instances of a specified string and replaces them.

      • replace regex: For advanced text manipulation using Regular Expressions.

    • Value: (Resource or Static) Provide the value to be used by the operator. For example, if the operator is equal, this is the new value. If the operator is add, this is the value to be added. This can be a static value (e.g., 1, true, "Active") or a dynamic value from another resource (e.g., {!anotherVariable}, @MyInput.value).

Practical Example

Creating a Dynamic Show/Hide Reply Container

Let's build the exact use case you described: a "Reply" button that shows a container with a reply form, and a "close" icon inside that panel to hide it again. This demonstrates how to manage component state.

1. Create a Boolean Variable for State

  • In Resources, create a new Boolean Variable.

  • API Name: isReplying

  • Initial Value: Set to false.

2. Create the Panel and Bind its Visibility

  • Drag a Container component onto your canvas. This will be your reply panel.

  • Inside the Container, place other components, like a Text Area for the reply message.

3. Create the "Reply" Button

  • Add an Avonni Button component outside the container.

  • Label: "Reply"

  • On Click Interaction:

    1. Add an Assignment action.

    2. Configure it:

      • Variable: {!isReplying}

      • Operator: equal

      • Value: false

4. Create the "Trash" Icon

  • Inside the reply Container, add an Icon component.

  • Icon Name: utility:close (or utility:delete if you prefer a trash icon). Make it clickable.

  • On Click Interaction:

    1. Add an Assignment action.

    2. Configure it:

      • Variable: {!isReplying}

      • Operator: equal

      • Value: true

5. Select the container component. In the “Set Component Visibility” settings, add a condition that shows the container only when the Reply button has been clicked and the isReplying variable is not set to true.

Result:

When the page loads, isReplying is false, so the container is hidden. Clicking the "Reply" button sets the variable to true, making the container and its contents appear. Clicking the "close" icon inside sets the variable back to false, hiding it again. This entire state change is managed declaratively with two simple Assignment interactions

Key Considerations

  • Data Types are Important: The add operator behaves differently on Numbers versus Text. Ensure your variable's data type matches the operation you intend to perform.

  • Variable Must Exist: You must create the Variable resource before you can use it in an Assignment action.

  • Chaining Actions: Assignment is often one step in a sequence of interactions. For example, you might first Assign a value to a variable, then Execute Flow using that new value as an input.

In Summary

The Assignment interaction is the fundamental tool for controlling and manipulating the data stored in your variables. It's the key to managing component states, creating counters, resetting forms, and building dynamic logic in response to user actions, all declaratively

Last updated 16 hours ago

Was this helpful?