# Create a rule

Go to **Setup** → **Routing** rules.

Click the **NEW RULE** button and fill in the fields in the window:

Fields marked with (\*) are mandatory.

* **Name (\*)** and **Description**: enter a name and a description for your rule.
* **Category**: this field contains the list of Categories created. Categories are labels associated with one or more rules to group them. Example: a category called INVOICE can be created for all rules relevant to invoices and accounting. Then, when configuring the Rule, you can specify that only rules of category INVOICE must be applied.
* **Delete source file**: for each rule, you can specify whether the original file that triggered the rule processing should be deleted. Deletion occurs after processing is successfully completed. Default: OFF.
* **Copy Source File to workarea**: some actions may change the content of the file (e.g. character set or EOL conversion, encryption). These actions can be applied to the original file that triggered the contract or to a copy of the original file. Default: ON.

{% hint style="warning" %}
In case of an error during the execution of the workflow, actions that have already been executed cannot be undone. So, if the rule is not completed successfully but some actions have been applied to the original file, this file will be partially processed and cannot be used for a new execution of this rule. By leaving the default **Copy Source File to workarea**, all actions will be applied to the copied file and the original file will not be affected. Obviously, big files will take time to be copied and disk space will be needed, so this decision must be carefully considered.
{% endhint %}

* **Status**: this option enables the rule to be used. When set to ON, the rule is active, when set to OFF, the rule is inactive. Default: ON.
* **Metadata \* / Add Metadata**: define the metadata values to filter the files to which the rule will be applied. 🚀 A maximum of 512 characters is supported. Note that this number includes the entire string of all names and all metadata configured. The defined filters are in AND, so the more filters are defined, the more selective the rule will be. See [Add Metadata](/data-mover-1.21/file-routing/create-a-rule/add-metadata.md) for a description of how to configure metadata.
* **Start Date, End Date**: to be operational, the rule must have a Start Date. It may not have an End Date – in this case, it will be valid forever.\
  Warning: If it does not have a Start Date, the rule cannot be applied or used.
* **Set priority**: if data in a file satisfies 2 different rules, one rule can have priority over the other. This priority overwrites the priority defined for the Category.


---

# 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.primeur.com/data-mover-1.21/file-routing/create-a-rule.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.
