# NotificationRule

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Reference](https://developer.m-files.com/APIs/gRPC-API/Reference/index.md) > [Messages](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.NotificationRule/

Struct for a single notification rule.

- **Full name:** `MFiles.NotificationRule`
- **Proto file:** [`mfiles/structs.proto`](https://developer.m-files.com/APIs/gRPC-API/downloads/proto/mfiles/structs.proto)

<a id="fields"></a>

## Fields

| Field | Type | Number | Description |
|---|---|---|---|
| <a id="f-id"></a>`id` | `int32` | 1 | The ID of the rule. Assigned by the server when the rule is created. |
| <a id="f-name"></a>`name` | `string` | 2 | The name of the notification rule. |
| <a id="f-object_filter"></a>`object_filter` | repeated [`SearchCondition`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.SearchCondition/index.md) | 3 | The search conditions that an object must meet for the rule to apply, combined with AND. The built-in rules include a "not deleted" condition (`STATUS_TYPE_IS_DELETED` equal to false). |
| <a id="f-subscriptions"></a>`subscriptions` | repeated [`EventSubscription`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.EventSubscription/index.md) | 4 | The events that trigger a notification. A single `EVENT_TYPE_OBJECT_NOTIFICATION` subscription makes the rule filter-based: it then notifies about the objects that match `object_filter`. |
| <a id="f-options"></a>`options` | [`NOTIFICATIONFLAGS`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.NOTIFICATIONFLAGS/index.md) | 5 | `is_enabled` turns the rule on, `send_digest` combines the day's notifications into one message, `exclude_self_triggered` leaves out events caused by the user, and `recurring` (filter-based rules only) repeats the notification for objects that still match. |
| <a id="f-is_common"></a>`is_common` | `bool` | 6 | True for a common rule that notifies the users and groups in `recipients`; false for a private rule of its owner. |
| <a id="f-recipients"></a>`recipients` | [`AccessControlList`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.AccessControlList/index.md) | 7 | For a common rule, the users and groups to notify. Not used by private rules. |
| <a id="f-notification_days_of_week"></a>`notification_days_of_week` | `uint32` | 8 | For filter-based rules, the days on which the rule is processed, as a bit mask: 1 Sunday, 2 Monday, 4 Tuesday, 8 Wednesday, 16 Thursday, 32 Friday, 64 Saturday. 127 means every day. |

<a id="used-by-methods"></a>

## Used by methods

- [IRPCNotificationRules.AddNotificationRule](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCNotificationRules/AddNotificationRule/index.md): Creates a notification rule and returns its ID.
- [IRPCNotificationRules.GetNotificationRules](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCNotificationRules/GetNotificationRules/index.md): Gets the caller's private notification rules and the common rules that apply to the caller.
- [IRPCNotificationRules.ModifyNotificationRule](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCNotificationRules/ModifyNotificationRule/index.md): Replaces a notification rule, identified by its `id`, with the given definition.

<a id="used-in-fields"></a>

## Used in fields

- [`AddNotificationRuleRequest.utf8szrule`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCNotificationRules/AddNotificationRule/index.md#request): The rule to create. Set `name`, `subscriptions` and usually `object_filter` and `options.is_enabled`; for a common rule also `is_common` and `recipients`. `id` is ignored.
- [`ModifyNotificationRuleRequest.utf8szrule`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCNotificationRules/ModifyNotificationRule/index.md#request): The complete new definition of the rule. `id` identifies the rule to change.
- [`GetNotificationRulesResponse.rules`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCNotificationRules/GetNotificationRules/index.md#response): The rules. Built-in common rules, such as "Assigned to me", have small fixed IDs.
