# Exercise 1: Customer Anniversary Email

In this exercise, store the records of a congratulatory email and a Premium Membership offer sent to the customer on the customer's anniversary.

## Requirements

For brevity reasons, and to stay focused on the intent of the exercise the actual emails are not sent. There will be a delay of two (2) minutes between both emails. The relevant email Activity records will only be added in the “UserName\_Acc\_Activities” entity. However, all the necessary events will be covered in this exercise.

1. Create a Flow component that will generate the required emails.&#x20;
2. Create a Flow that reflects the sequence of activities involved in the exercise.&#x20;
3. This Flow component will contain mapped fields, which are input fields so the user can enter the details needed so it will be used during the execution of the Flow.&#x20;
4. This Flow component will be placed twice in the Flow, each for a different email purpose. The position reflects the activity in the Flow.
   1. In the first execution of the Flow component, it will send the customer anniversary email (The first email record will be congratulating the customer on the anniversary.)\
      The details of the email needed will be configured through the mapped fields. The information of these fields will be used in the entity record of “UserName\_Acc\_Activities”.&#x20;
   2. In the second execution, (the second email record will offer the customer a 30-day trial of Premium Subscription.) The offer details are added through mapped fields. The information of these mapped fields will be used in the entity record of “UserName\_Acc\_Activities”.
5. There will be a delay of two (2) minutes (instead of 2 days) after the Flow component is executed the first time.&#x20;
6. The Flow component will load the customer entity's record from “UserName\_Acc\_customers” to find the customer's email.&#x20;
7. After the Flow component is placed in the Flow and configured, the Flow component events will be used to link the next Flow component in sequence. This forms a series of activities that reflects the business process.&#x20;
8. When the Flow is executed, based on the current date and the values provided by the user in the field mapping of the Flow component, an activity record will be created in the entity “UserName\_Acc\_Activities”.

<figure><img src="https://media.langstack.com/documentation/media/images/code/training_manual/chapter_13/ch13ex1flow.png" alt=""><figcaption></figcaption></figure>

## Solution

This solution comprises the following steps:&#x20;

* Step 1: Creating a Flow component, which the user will define with details to create an email record and trigger relevant events.&#x20;
* Step 2: Create a Flow defining a target entity to store the email records. The Flow component will be placed twice In the Flow:&#x20;
  * The first Flow component sends the anniversary email.&#x20;
  * A delay of two (2) minutes is defined after sending the first mail, which means a Delay Flow component will be placed after the first Flow component “Sent” event with delay duration defined as two (2) minutes.&#x20;
  * The second Flow component sends a free Premium Membership offer email.&#x20;
* Step 3: Trigger the Flow in a Process to store the created records in the target entity.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.langstack.com/welcome/get-started/learn-langstack/introduction-to-flows-and-flow-components/exercise-1-customer-anniversary-email.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
