Hey @manan.modi! You want to save a specific reference ID to your database based on the selected value from the dropdown.
Here’s a step-by-step solution:
Step 1: Create an Option Set (recommended for managing dropdown values and IDs)
-
Go to Data > Option sets.
-
Create a new Option Set, for example, Status.
-
Add attributes to this Option Set:
Display (text): This will hold the status name, like “Pending,” “Completed,” etc.
Reference ID (number): This will hold the ID you want to store in the database, like 1 for “Pending,” 2 for “Completed,” etc.
- Under your new Option Set, create options for each status (e.g., Pending, Completed, Picked). For each option, assign a unique Reference ID.
Step 2: Update Your Dropdown
-
Set your dropdown’s Type of Choices to the new Option Set you created (e.g., Status).
-
Set Choices Source to All Status (or whatever you named the Option Set).
-
For the Option Caption, select the Display attribute to show “Pending,” “Completed,” etc., as dropdown options.
Step 3: Store the Reference ID in the Database
-
Create a new workflow for when the dropdown’s value is changed.
-
Add an action to this workflow that creates or updates a record in your database.
-
In the field where you want to store the reference ID, set it to Dropdown Status’s value’s Reference ID.
Example Workflow
-
Trigger: When Dropdown’s value is changed.
-
Action: Create a new entry (or Make changes to a thing in the database).
-
Set the field (e.g., P_id) to Dropdown Status’s value’s Reference ID.
Why This Works
Using Option Sets keeps your values and reference IDs organized and makes it easy to add, remove, or update options later. When you select an option in the dropdown, Bubble will directly access the Reference ID attribute without needing additional “Find and Replace” logic.
Let me know if this helps, or if you need any more details!