# Add Record Stage

<div align="left"><img src="https://531923687-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnhvnNmu6p9CSODwQTjgf%2Fuploads%2FolFp43wybTemzoCAovY3%2F0.png?alt=media" alt="" width="375"></div>

## **Add Record**

**Interface Overview**

1\. Select Repository

* Choose the repository where the new record should be added.

2\. Fields Mapping

Each field in the repository can be mapped using the dropdowns:

| Component    | Description                                                              |
| ------------ | ------------------------------------------------------------------------ |
| Select Field | Choose the field from the repository you want to populate.               |
| Select Value | Choose how the field will be populated: Custom, Calculated, or 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 → Shows a dropdown of all available variables.
  * If the variable is a record or records type, an additional text field is shown to specify the record parameters.

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 → Displays a dropdown with all workflow variables. If variable is from a record or records type, additional field appears to input parameters.

**Example**

To add a record to a "Candidate Applications" repository:

| Field           | Select Value           | Result on RHS (Right-hand Side)                                                       |
| --------------- | ---------------------- | ------------------------------------------------------------------------------------- |
| Name            | Custom                 | Displays a text field. Manually enter: "Raaghav"                                      |
| Email           | Variable               | Displays a dropdown with all available variables                                      |
| Experience      | Calculated             | Displays a multiline text area. Enter calculated expression like: {{Years}} + 1       |
| Date of Joining | Custom                 | Displays a date picker or text field to manually enter/select the date                |
| Education       | Variable (Record type) | Displays a dropdown of variables and a text field to enter record-specific parameters |

**Best Practices**

* Use Custom for fixed text/numeric input.
* Use Variable for dynamic inputs from earlier stages.
* Use Calculated for formulas involving variables or expressions.

## **Add Record Stage Under For Each**

This document explains how to configure and use the Add Record stage inside a For Each stage to create new records dynamically based on a list or collection from a repository.

**Overview**

The For Each stage is used to iterate over a list of items (typically a repository containing multiple records).\
Within it, the Add Record stage is used to insert a new record for each item that matches an optional condition.

**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.

**Add Record Stage – Inside For Each**

This stage is used to create a new record for each item in the loop.

**Configuration Steps**

1\. Select Target Repository

Choose where the new record should be added.\
Example: Interview Schedule

2\. Field Mapping

For each field in the target repository, define how its value will be populated:

| Field Type                                                                                  | <p>Supported Value</p><p>Types</p>                | RHS Behavior (Right-Hand Side)                                                                                              |
| ------------------------------------------------------------------------------------------- | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| Text, Email, Select, Checkbox, Lookup, Location, User or group, Hyperlink, Attachment, etc. | Custom, Variable, For Each Repository             | <p>- Custom: Text field<br>- Variable: Dropdown of variables<br>- For Each Repository: Dropdown of fields</p>               |
| Decimal, Number, Date                                                                       | Custom, Calculated, Variable, For Each Repository | <p>- Custom: Text/Date input<br>- Calculated: Multiline expression editor<br>- Variable/For Each: Dropdown or item path</p> |

"Select Value" Options (Dropdown Explanation)

| Option              | Description                                                                                          |
| ------------------- | ---------------------------------------------------------------------------------------------------- |
| Custom              | Manually input a fixed value. Example: "Scheduled"                                                   |
| Calculated          | Use expressions like {item.Score} \* 0.5                                                             |
| Variable            | Select from available workflow variables (outside loop context)                                      |
| For Each Repository | Select from fields of the current item ({item}) being looped. Dropdown shows fields like Name, Email |

**Example Scenario**

Goal: For every shortlisted candidate, add a record to the *Interview Schedule* repository.

For Each Stage:

* Repository: Candidate
* Condition: Status == "Shortlisted"

Add Record Configuration:

| **Field Name**  | **Select Value**    | **RHS Configuration**                     |
| --------------- | ------------------- | ----------------------------------------- |
| Candidate Name  | For Each Repository | Select Name → becomes Name                |
| Candidate Email | For Each Repository | Select Email → becomes Email              |
| Interview Date  | Custom              | Manually pick a date or enter fixed value |
| Score Weight    | Calculated          | Enter {Score} \* 0.5                      |
| Interviewer     | Variable            | Select {AssignedInterviewer}              |

## **Add Record Stage Under Condition Stage**

The Add Record stage can be placed inside a Condition stage to create a new record only when specific criteria are met.

**Condition Stage – Overview**

Purpose:

The Condition stage evaluates a boolean expression using workflow variables.\
If the condition returns true, the nested stages (like Add 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: 5

**Add 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 where the new record should be added.

Example: Offer Letters

2\. Field Mapping:

| Field Type                                                                                  | Supported Value Types        | RHS Behavior (Right-Hand Side)                                                                                 |
| ------------------------------------------------------------------------------------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------- |
| Text, Email, Select, Checkbox, Lookup, Location, User or group, Hyperlink, Attachment, etc. | Custom, Variable             | <p>- Custom: Text field<br>- Variable: Dropdown of available variables</p>                                     |
| Decimal, Number, Date                                                                       | Custom, Calculated, Variable | <p>- Custom: Text/Date input<br>- Calculated: Multiline expression editor<br>- Variable: Variable dropdown</p> |

**Example Scenario**

Goal: If a candidate is selected, create a new Offer Letter record.

Condition Configuration:

* Select variable: Total Score
* Condition: Greater Than or Equal To
* Value: 5

Add Record Configuration (inside true path)

| Field          | Select Value | RHS Result                     |
| -------------- | ------------ | ------------------------------ |
| Candidate Name | Variable     | ${Variable:Candidate\_Name}    |
| Email          | Variable     | $Variable:Candidate\_Email}    |
| Offer Status   | Custom       | "Draft"                        |
| Salary Offered | Calculated   | {Candidate.ExpectedCTC} \* 1.1 |
