# Creating a Populate Event Rule Template

This rule template allows you to define a rule that can use data from surveys to automatically populate an event's date and time.

## Prerequisites

* Ensure that the survey and schedule are already created.
* The event you want to populate must be set up to be Populated By: Rule. The system will not let you create this rule template if no events are configured this way.
* Ensure that all survey names, schedule names, event names, and group names are correct.

### Create Populate Event Rule

1. In eCOA Studio, open the **Rules** tab.
2. Select **Create Rule**.
3. In the Rule Templates dialog box, select **Populate Event** and select **Select Template**. A new rule template for populating events opens.
4. Enter a **Name** for the rule, for example, Rule_1.
5. Enter a **Description** of what the rule is for. The description helps other Studio users identify what the rule is when they see it in the Rules tab. <br>
<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: The system automatically sets a precondition. This precondition confirms that the survey in the rule’s reference is in a compliant status. No expression is defined for this rule.</p>
    </div>
  </div>
</div>


{:start="6"}
6. Define the **Trigger** by referencing a single survey or survey part. The system will run the rule when the conditions for the survey or survey part are met. 
    - The reference must start with $ and cannot use wildcards (*) for schedules or events.
    - You can use wildcards (*) or specific instance numbers for the survey instance. This lets you update the event datetime if a second survey is submitted. 
7. Select the event you want to populate from the **Select Event** list. The list only includes events that have been configured to be populated by a rule and that have not already been used by a different rule template.
8. Select a data type from the **Populate With** options: **Datetime**, **Date and Time**, or **Date**.
9. Enter a reference for the data. Use variables from the Rule Tools section, or enter an @ reference. The reference must point to the same survey or survey part you referenced in the trigger. 
    - If you chose Datetime, you must enter a datetime reference and can optionally enter a time to override the time from the survey data.
    - If you chose Date and Time, you must provide both a date reference and a time reference. 
    - If you chose Date, you must enter a date reference and also provide a time in 24-hour format.
10. Select **Save**.

## Saving a Rule

Draft template changes are automatically saved as you make updates. If you sign out and back in, when you access the templates, you can continue working on your draft. If you choose to create a new draft before manually saving an in-progress draft, your changes will be lost. 

You can save a rule by selecting the **Save** button.

## Editing a Rule

You can edit a rule when the collection is in a Draft state.

Complete the following steps to edit a rule:

1. Open the collection, select the **Rules** tab, and select the **Edit Rule** icon (<img class="inline" src="https://platform.veevavault.help/assets/images/23r2_ePRO_edit_button.png" alt="Edit Rule icon" style="" />) next to the rules you want to edit.
2. Make any changes you want to see, and select **Save**. Your changes are saved.

## Deleting a Rule

You can only delete rules that have not been included in an approved collection. Once a rule is deleted, it cannot be recovered.

Complete the following steps to delete a rule:

1. Open the collection, select the **Rules** tab, and select the **Delete Rule** icon (<img class="inline" src="https://platform.veevavault.help/assets/images/24r2_delete_icon.png" alt="Delete icon" style="" />) next to the rule you want to delete. A confirmation box opens.
2. Select **Delete**. The rule is deleted.

## Related Resources
- <a href="/en/gr/918793/">Creating a Survey-Based Notification Rule Template</a>
- <a href="/en/gr/918791/">Understanding Rules</a>