# 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](https://1117313960-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fcloudio-new-documentation%2F-M2HCsG_ysFH61cWcVZL%2F-M2HD9PWLKP_N9IBkjoN%2F0.png?generation=1584074893574733\&alt=media). The **Actions** window is displayed.

![](https://1117313960-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fcloudio-new-documentation%2F-M2HCsG_ysFH61cWcVZL%2F-M2HD9PXHMz4uIMJp8fn%2F1.png?generation=1584074893626146\&alt=media)

![](https://1117313960-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fcloudio-new-documentation%2F-M2HCsG_ysFH61cWcVZL%2F-M2HD9PYHWC6krkje1Ij%2F2.png?generation=1584074894627854\&alt=media)

&#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> |
