# Defining email actions

Email actions are defined for a datasource to send email notifications when a user performs any DML operation through the user interface.

To define an email action,

1. In the **Details** tab, under **Actions**, click ![C:\Users\user\Dropbox\Preeti\_ibruk\CloudIO\Deliverables\Icons\Add Attribute.png](/files/-M2HD9PWLKP_N9IBkjoN). The **Actions** window is displayed.

![](/files/-M2HD9PXHMz4uIMJp8fn)

![](/files/-M2HD9PYHWC6krkje1Ij)

&#x20;2\. Enter/select the following details:

| **Field**       | **Description**                                                                                                                                                           |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Name            | The name of the action                                                                                                                                                    |
| Active          | Indicates an email is to be sent after every select operation                                                                                                             |
| Insert          | Indicates an email is to be sent after every insert operation                                                                                                             |
| Update          | Indicates an email is to be sent after every update operation                                                                                                             |
| Delete          | Indicates an email is to be sent after every delete operation                                                                                                             |
| Start Date      | The start date for the action                                                                                                                                             |
| End Date        | <p>The end date for the action</p><p><em><strong>Note</strong>: If end date matches with the system date ,then the action will become inactive.</em></p>                  |
| Description     | The description of the action being defined                                                                                                                               |
| Condition       | <p>The expression for the condition on which the email is to be sent<br><em><strong>Note</strong>: The email will be sent when the expression evaluates to true.</em></p> |
| Email Address\* | The email address to which the notification is to be sent                                                                                                                 |
| Attachment      | The attachment to be sent with the notification                                                                                                                           |
| Subject\*       | The subject of the notification email                                                                                                                                     |
| Cc/Bcc          | Email addresses of the participants to be copied                                                                                                                          |

&#x20;3\. In the rich text editor, enter the contents of the notification email that is to be sent and click **Save**.

The email action is saved for the datasource.

The following expressions can be used in place of dynamic values in the **Email Address**, **Subject**, **Body** and **Attachment** fields:

| **Expression**                                                 | **Function**                                                                                                                                      |
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| #{attributeName}                                               | To replace an attribute value of the record being inserted, updated or deleted                                                                    |
| #{parent.attributeName}                                        | To use an attribute value from the master record, if it exists                                                                                    |
| #{dbrow\.attributeName}                                        | To refer a value from the database for update actions                                                                                             |
| #{session.sessionValue}                                        | To access session variables                                                                                                                       |
| #{SELECT 'x' from some\_table WHERE column = #{attributeName}} | <p>To create a nested expression.</p><p><em><strong>Note</strong>: The innermost expression will be evaluated before the out expression.</em></p> |


---

# 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.cloudio.io/creating-datasources/working-with-datasources/creating-a-data-source/defining-email-actions.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.
