Ask AI
Skip to main content

Get code of dropdown field

Function: Get code of dropdown field

This action allows you to retrieve the unique "code" value associated with the currently selected option in a specific dropdown field on your application's page. This is useful for identifying the selected item programmatically, especially when the display text of the dropdown option might not be unique or suitable for backend logic.

Input

  • UI element
    • Type: UI Element (specifically a Dropdown Field)
    • Description: Select the dropdown field component from your application's page that you want to get the code from. This field must be present on the page.

Output

  • Code
    • Type: Text (STRING)
    • Description: This is the variable where the unique code value from the selected dropdown option will be stored. You will need to provide a name for this variable.

Execution Flow

Real-Life Examples

Example 1: Conditional Display based on Product Category

  • Scenario: You have a product order form. When a user selects a product category from a dropdown, you want to display specific fields relevant to that category. Each category has a unique internal code (e.g., "ELEC" for Electronics, "CLO" for Clothing).
  • Inputs:
    • UI element: ProductCategoryDropdown (the dropdown field on your form)
    • Code (Output Variable Name): selectedCategoryCode
  • Result: The unique code of the selected product category (e.g., "ELEC") is stored in the variable selectedCategoryCode. You can then use this variable in a conditional action to show/hide relevant sections of your form.

Example 2: Dynamic Pricing based on Service Type

  • Scenario: A service booking application where different service types have different pricing rules. You need to fetch the specific service code to apply the correct pricing logic.
  • Inputs:
    • UI element: ServiceTypeDropdown (the dropdown field where users select a service)
    • Code (Output Variable Name): currentServiceCode
  • Result: The unique code for the chosen service type (e.g., "PREMIUM_INSTALL") is saved in the currentServiceCode variable. This variable can then be used to look up pricing in a database or apply a calculation.

Example 3: Integrating with an External System using an Identifier

  • Scenario: You are building an application that integrates with an external CRM. When a user selects a "Lead Source" from a dropdown, you need to send the CRM's internal identifier for that source, not just its display name.
  • Inputs:
    • UI element: LeadSourceDropdown (the dropdown field for lead sources)
    • Code (Output Variable Name): crmLeadSourceId
  • Result: The CRM's internal identifier for the selected lead source (e.g., "WEB_FORM_ID_789") is stored in the crmLeadSourceId variable, ready to be sent to the CRM system.