# Get Record Stage

**Get Record Stage**

The **Get Record** stage is used to **retrieve a single record** from a specific repository (sheet or table) based on provided filters. The retrieved record can then be used in later stages (e.g., Update Record, Send Email, AI stage, etc.).

<figure><img src="https://160083056-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmK2RCoJJtarg5gUVoIgX%2Fuploads%2FAxK5gS1mSb8A5nBSQeZ8%2Fimage.avif?alt=media&#x26;token=ad9548c7-21e7-418c-bdd9-d9c195fd167a" alt="" width="563"><figcaption></figcaption></figure>

**Interface Overview**

1\. Select Repository:

Choose the repository from which the record should be fetched.

Example: Job Tracker, Customer.

2\. Filters:

Define the condition(s) to identify the record. You can apply one or more filters.

Filter:

Define how to find the matching record.

| Component        | Description                                                                                          |
| ---------------- | ---------------------------------------------------------------------------------------------------- |
| Select Field     | Choose the field from the repository based on which the filter will work. Example: Email, Record ID. |
| Select Condition | Select the condition eg: Equal, Not equal, contain                                                   |
| Select Value     | Select the value eg. Custom, Calculated, Variable                                                    |

**Field Behavior by Type**

A. Field Types Supporting Custom and Variable Value

* Single Line
* Multi Line
* Email
* Checkbox
* Lookup
* Multiselect
* Select
* Attachment
* User or Group
* Hyperlink
* Location

When selected:

* Custom → Shows a simple text field to manually input a value (e.g., Name>>Custom>>"Raaghav").
* Variable → An additional text field is shown to specify the variable as ${Variable:VariableName}
  * If the variable is a record or records type, an additional text field is shown to specify the record parameters. Eg. ${Variable:VariableName:Field Name}

B. Field Types Supporting Custom, Calculated, and Variable Value

* Decimal
* Number
* Date

When selected:

* Custom → Displays a text input (e.g., enter 200.5 for a decimal).
* Calculated → Displays a multi-line expression editor for formulas or expressions (e.g., {{Total}} \* 0.18).
* Variable → An additional text field is shown to specify the variable as ${Variable:VariableName}
  * If the variable is a record or records type, an additional text field is shown to specify the record parameters. Eg. ${Variable:VariableName:Field Name}

3\. Select Field:

Shows all fields available in the selected repository. Select only the fields you want to retrieve

**Example: Get Record Stage – Retrieve Candidate by Email**

**Use Case:**

You want to fetch a candidate’s details from the **Job Applicants** repository using their email address, which was submitted in a previous form.

**Configuration Steps:**

1\. Select Repository

* Select: Job Applicants

2\. Filters

You want to filter records where the Email field matches the email received from a previous form stage.

| **Component**    | **Value**                              |
| ---------------- | -------------------------------------- |
| Select Field     | Email                                  |
| Select Condition | Equal                                  |
| Select Value     | Variable → ${Variable:FormInput:Email} |

This tells the system: “Fetch the record where the Email equals the email entered in the form.”

**Field Behavior Explanation:**

Since Email is a "Single Line" type, it supports Custom and Variable inputs.

* Custom → You could manually enter <abc@gmail.com> (for testing).
* Variable → Use ${Variable:FormInput:Email} to dynamically get the value from a previous stage.

3\. Select Field:

All fields in the Job Applicants repository will be shown. Select the fields you want to use in the rest of the flow. For example:

* Candidate Name
* Experience
* Phone Number
* Current Status

Only the selected fields will be fetched and stored.

**Output Usage:**

Assume you’ve stored the output in a variable named FetchedRecord.

You can now use:

${Variable:FetchedRecord:Candidate Name}

${Variable:FetchedRecord:Phone Number}

${Variable:FetchedRecord:Experience}

${Variable:FetchedRecord:Current Status}

in any subsequent stage like Send Email, Update Record, or AI prompt.

### **Get Record Stage Under For Each**

In AiFlo, the **Get Record** stage can be nested inside a **For Each** loop to dynamically retrieve records **one by one based on the current item in the loop**. This is useful when you want to:

* Fetch related data from another repository for each item
* Enrich or compare the current loop item with a matching record
* Perform conditional operations based on joined data

**For Each Stage – Configuration**

1\. Select Repository

Choose the repository you want to loop over.\
Example: Candidate

2\. Condition

You can apply a condition to filter which items should be processed.

Example Condition: Status == "Shortlisted"\
This ensures only shortlisted candidates are processed in the loop.

**Get Record Stage – Inside For Each**

The **Get Record** stage inside a **For Each** loop is used to **fetch a related record** for the current loop item using one or more filters.

**Configuration Steps**

1\. Select Repository:

Choose the repository from which the record should be fetched.

Example: Job Tracker, Customer.

2\. Filters:

Define the condition(s) to identify the record. You can apply one or more filters.

Filter:

Define how to find the matching record.

| Component        | Description                                                                                          |
| ---------------- | ---------------------------------------------------------------------------------------------------- |
| Select Field     | Choose the field from the repository based on which the filter will work. Example: Email, Record ID. |
| Select Condition | Select the condition eg: Equal, Not equal, contain                                                   |
| Select Value     | Select the value eg. Custom, Calculated, Variable                                                    |

**Field Behavior by Type**

A. Field Types Supporting Custom and Variable Value

Single Line, Multi Line, Email, Checkbox, Lookup, Multiselect, Select, Attachment, User or Group, Hyperlink, Location

When selected:

* Custom → Shows a simple text field to manually input a value (e.g., Name>>Custom>>"Raaghav").
* Variable → An additional text field is shown to specify the variable as ${Variable:VariableName}
  * If the variable is a record or records type, an additional text field is shown to specify the record parameters. Eg. ${Variable:VariableName:Field Name}

B. Field Types Supporting Custom, Calculated, and Variable Value

* Decimal
* Number
* Date

When selected:

* Custom → Displays a text input (e.g., enter 200.5 for a decimal).
* Calculated → Displays a multi-line expression editor for formulas or expressions (e.g., {{Total}} \* 0.18).
* Variable → An additional text field is shown to specify the variable as ${Variable:VariableName}
  * If the variable is a record or records type, an additional text field is shown to specify the record parameters. Eg. ${Variable:VariableName:Field Name}

3\. Select Field:

Shows all fields available in the selected repository. Select only the fields you want to retrieve

**Example: Get Record Stage – Retrieve Candidate by Email**

**Use Case:**

You want to fetch a candidate’s details from the **Job Applicants** repository using their email address, which was submitted in a previous form.

**Configuration Steps:**

**1. Select Repository**

* Select: Job Applicants

**2. Filters**

You want to filter records where the Email field matches the email received from a previous form stage.

| **Component**    | **Value**                              |
| ---------------- | -------------------------------------- |
| Select Field     | Email                                  |
| Select Condition | Equal                                  |
| Select Value     | Variable → ${Variable:FormInput:Email} |

This tells the system: “Fetch the record where the Email equals the email entered in the form.”

**Field Behavior Explanation:**

Since Email is a "Single Line" type, it supports Custom and Variable inputs.

* Custom → You could manually enter <abc@gmail.com> (for testing).
* Variable → Use ${Variable:FormInput:Email} to dynamically get the value from a previous stage.

**Select Field:**

All fields in the **Job Applicants** repository will be shown. Select the fields you want to use in the rest of the flow. For example:

* Candidate Name
* Experience
* Phone Number
* Current Status

Only the selected fields will be fetched and stored.

**Output Usage:**

Assume you’ve stored the output in a variable named FetchedRecord.

You can now use:

${Variable:FetchedRecord:Candidate Name}

${Variable:FetchedRecord:Phone Number}

${Variable:FetchedRecord:Experience}

${Variable:FetchedRecord:Current Status}

in any subsequent stage like Send Email, Update Record, or AI prompt.

**Example Scenario: Get Candidate Details for Shortlisted Applicants**

**Goal**

You have a repository called **“Candidate Applications”** that contains basic information like candidate name, email, and status.\
For each **shortlisted** candidate, you want to fetch **detailed job application data** (such as qualification, total experience, and expected salary) from a second repository called **“Job Applications”**, based on the candidate's email address.

**For Each Stage Configuration**

| **Configuration** | **Value**                                    |
| ----------------- | -------------------------------------------- |
| **Repository**    | Candidate Applications                       |
| **Condition**     | Status == "Shortlisted"                      |
| **Loop Variable** | item (represents each shortlisted candidate) |

**Get Record Stage (Inside For Each)**

This stage is used to fetch **additional details** from the **Job Applications** repository for each shortlisted candidate using their email as the common identifier.

**Configuration:**

| **Component**          | **Value**                                                    |
| ---------------------- | ------------------------------------------------------------ |
| **Select Repository**  | Job Applications                                             |
| **Select Field**       | Email                                                        |
| **Select Condition**   | Equal                                                        |
| **Select Value**       | For Each Repository → Email (becomes ${Variable:item.Email}) |
| **Fields to Retrieve** | Qualification, Experience, Expected Salary                   |
| **Output Variable**    | ApplicationDetails                                           |

**How the Workflow Uses This**

After retrieving the detailed record, you can:

* Use ${Variable:ApplicationDetails:Qualification} in an AI prompt to generate interview questions
* Use ${Variable:ApplicationDetails:Expected Salary} in a comparison logic to check salary fit
* Send an email to HR with all details for scheduling interviews

**Result**

For each candidate in Candidate Applications with Status = Shortlisted, AiFlo will:

1. Loop through the record
2. Fetch matching details from Job Applications
3. Store them in ApplicationDetails
4. Use the fetched data in downstream stages like:
   * **Decision** (e.g., Expected Salary < Budget)
   * **Email** (Send personalized details to interviewer)
   * **Update Record** (e.g., Mark as “Ready for Interview”)

### **Get Record Stage Under Condition Stage**

In AiFlo, the Get Record stage can be placed within a Condition branch to fetch a record only when specific criteria are met. This is useful when you need to selectively retrieve data based on a decision, toggle, or logical condition.

**Condition Stage – Overview**

Purpose:

The Condition stage evaluates a boolean expression using workflow variables.\
If the condition returns true, the nested stages (like Get Record) are executed.\
If false, they are skipped.

**Configuration:**

Add a Condition Stage:

* Drag and drop the Condition Stage into your workflow.
* Choose “Condition” (not Condition Set).
* Set logic (e.g., AND).
* Select variable: Total Score
* Condition: Greater Than or Equal To
* Value: 3

**Get Record Stage – Inside Condition:**

This stage is used to insert a new record only when the condition evaluates to true.

1\. Select Repository:

Choose the repository from which the record should be fetched.

Example: Job Tracker, Customer.

2\. Filters:

Define the condition(s) to identify the record. You can apply one or more filters.

Filter:

Define how to find the matching record.

| Component        | Description                                                                                          |
| ---------------- | ---------------------------------------------------------------------------------------------------- |
| Select Field     | Choose the field from the repository based on which the filter will work. Example: Email, Record ID. |
| Select Condition | Select the condition eg: Equal, Not equal, contain                                                   |
| Select Value     | Select the value eg. Custom, Calculated, Variable                                                    |

**Field Behavior by Type**

A. Field Types Supporting Custom and Variable Value

Single Line, Multi Line, Email, Checkbox, Lookup, Multiselect, Select, Attachment, User or Group, Hyperlink, Location

When selected:

* Custom → Shows a simple text field to manually input a value (e.g., Name>>Custom>>"Raaghav").
* Variable → An additional text field is shown to specify the variable as ${Variable:VariableName}
  * If the variable is a record or records type, an additional text field is shown to specify the record parameters. Eg. ${Variable:VariableName:Field Name}

B. Field Types Supporting Custom, Calculated, and Variable Value

* Decimal
* Number
* Date

When selected:

* Custom → Displays a text input (e.g., enter 200.5 for a decimal).
* Calculated → Displays a multi-line expression editor for formulas or expressions (e.g., {{Total}} \* 0.18).
* Variable → An additional text field is shown to specify the variable as ${Variable:VariableName}
  * If the variable is a record or records type, an additional text field is shown to specify the record parameters. Eg. ${Variable:VariableName:Field Name}

3\. Select Fields:

Shows all fields available in the selected repository. Select only the fields you want to retrieve

**Example Scenario: Retrieve Employee Details If Performance Score is Low**

**Business Goal:**

Automatically fetch detailed employee records **only** if their **performance score is less than 3**, so the HR team can review and prepare for a Performance Improvement Plan (PIP).

**Workflow Flow:**

1. **Trigger Stage:** Form is submitted by a manager with performance score.
2. **Condition Stage:** Checks if the performance score is below 3.
3. **Get Record Stage (Inside Yes branch):** Fetch employee details from the Employee Master repository using the employee’s email.
4. **Follow-up Stages:** Use retrieved data in an email, AI summary, or assign to HR.

**Configuration:**

**Condition Stage**

| **Field** | **Value**                               |
| --------- | --------------------------------------- |
| Variable  | ${Variable:FormInput:Performance Score} |
| Condition | Less Than                               |
| Value     | 3                                       |

**Get Record Stage (Inside Yes Branch)**

| **Field**        | **Value**                                    |
| ---------------- | -------------------------------------------- |
| Repository       | Employee Master                              |
| Select Field     | Email                                        |
| Select Condition | Equals                                       |
| Select Value     | ${Variable:FormInput:Employee Email}         |
| Fields to Fetch  | Name, Department, Joining Date, Manager Name |
| Output Variable  | EmployeeDetails                              |

**Output Usage**

Use ${Variable:EmployeeDetails:Department} and ${Variable:EmployeeDetails:Manager Name} to:

* Generate a custom email to HR
* Trigger a task assignment
* Add to a PIP tracking sheet

**Result**

Only when an employee’s performance score is less than 3, the workflow:

* Fetches their details
* Alerts the HR team
* Automates the next steps toward corrective action
