Fetch data record by ID
Function: Fetch data record by ID
This action allows you to retrieve a single data record from your application's built-in database using its unique identifier (ID). It's useful when you need to access specific information, like a customer's details, a product's specifications, or an order's status, based on a known ID.
Input
- Id (Required, Text): The unique identifier of the data record you want to find. This ID is typically generated automatically when a record is created.
- Data-format (Required, Data Table/Schema): The specific data table or schema that the data record belongs to. This helps the system know where to look for the record.
- Attributes (Optional, List of Attributes): A list of specific fields you want to retrieve from the data record. For example, if you're fetching a "Customer" record, you might only need their "Name" and "Email". If you leave this empty, all fields of the data record will be fetched.
Output
- Data variable name (Object): This is the name of the variable that will store the retrieved data record. By default, this variable is named
FOUND_DATA. If a record with the specified ID is found, this variable will contain all the selected fields of that record. If no record is found, this variable will be empty.
Execution Flow
Real-Life Examples
Example 1: Fetching a Customer Record with Specific Details
Imagine you have a "Customers" data table, and you want to display a customer's name and email on a profile page after they log in. You know their customer ID from the login process.
- Inputs:
- Id:
cust_12345 - Data-format:
Customers - Attributes:
NameEmail
- Id:
- Result: The variable
FOUND_DATAwill contain an object like\{ "Name": "Alice Smith", "Email": "[email protected]" \}. You can then use these values to populate fields on your customer profile page.
Example 2: Retrieving a Product's Full Information
You're building an e-commerce product detail page. When a user clicks on a product, you need to fetch all its details from the "Products" data table using the product's ID.
- Inputs:
- Id:
prod_abc789 - Data-format:
Products - Attributes: (Left empty)
- Id:
- Result: The variable
FOUND_DATAwill contain the complete product object, including fields like\{ "Name": "Wireless Headphones", "Price": 99.99, "Description": "High-quality sound...", "Stock": 150, "Category": "Electronics" \}.
Example 3: Checking if an Order Exists
Before processing a return, you want to quickly verify if an order with a given ID actually exists in your "Orders" data table. You don't need any specific details, just confirmation of its presence.
- Inputs:
- Id:
order_xyz001 - Data-format:
Orders - Attributes: (Left empty)
- Id:
- Result:
- If the order exists, the variable
FOUND_DATAwill contain the full order object. You can then check ifFOUND_DATAis not empty to confirm the order's existence. - If the order does not exist (e.g.,
order_xyz002), the variableFOUND_DATAwill be empty, indicating that no such order was found.
- If the order exists, the variable