Klevr Product Documentation logo

Notification Framework Usage

The Klevr Notification framework allows you to configure notifications (Email/task/In App notification) for any activity-enabled entity available in...

Feature Overview

The Klevr Notification framework allows you to configure notifications (Email/task/In App notification) for any activity-enabled entity available in Dynamics. It runs daily and creates notifications for records based on the configuration.

Design Details

To configure the notification service, navigate to the settings area of a klevr app, and find the notifications entity in the notification section. From here you can create or update notification configurations. You can have multiple configurations for a single entity, but typically you would have one configuration per entity you wish to be notified on.

The values of each field should be configured as follows:

Entity Schema Name:

This will hold the value of entity logical name, Example: account, contact, klevr_order

FetchXml:

This is multiline string which holds the fetch query of list of records that need notification. Entity schema name should be match with fetchxml query. For example: system should send the notification for all the contracts that expires in next 7 days. This fetchxml query can contain linked entities and linked entity attributes can also be included. It is important to include all the attributes that are used in the rest of the configuration, for instance, the users being notified (e.g. ownerid or createdby), the key fields used for record change detection (see below) and any fields used in the contents of the notifications.

Description:

This is used to describe the notification configuration for internal use.

Reminder:

This is multi picklist field which hold 3 types of notification, Email, Task, in App Notification. User can select any combination of notification types to be generated.

Notify To:

This string field where we can provide list of "dynamic" users who need to receive the notifications. For example: createdby,modifiedby,ownerid (If we want to send notification to createdby, modifiedby and ownerid field value(users)). You can also use fields from linked entities by providing the linked entity alias name, e.g. account.ownerid. Ensure that this linked entity and attribute is part of your fetchxml.

Notify Specific User:

This is a Lookup to the system user entity and holds the specific user record if we want to notify the specific user for all applicable records.

Key Fields:

Key fields are used to identify changes to records, and to trigger re-notification. We use the key fields to generate a log of notifications and prevent re-notifying the same record if it has not changed. If any of the fields are changed and the record is returned in a subsequent query of the fetchxml, it will receive a new notification. It is recommended to add any filtering fields to the key fields.

For instance, if you are checking an expiry date in the next 7 days, add the expiry date to the key fields. This way, if the record is notified on day 1 of 7, it will not be re-notified, but if the expiry date changes, then it will be eligible for a notification again, if it meets the filter criteria.

Key fields can contain linked entity attributes as well by prefixing them with the linked entity alias.

If no fields are specified, the record ID will be used.

It is important to note that if you do not specify key fields, a record will only ever get notified ONCE in its entire lifetime. If you have a process to notify records on a renewal date and the renewal date is moved to next year, the renewal date must be used in the key attributes, otherwise the record will not be re-notified the following year. This is because without key fields, only the ID is used to check if the record has been notified before. By adding the renewal date, the date will change for next year, and therefore the change will be picked up and a new notification created.

Email Template:

This will shows a list of email Templates in the system. It is important to select a template that targets the same entity as the notification configuration. Email templates only apply to Email notifications. If no template is selected, the email will get the same Title and Body as defined below and used for the In app and Task notifications.

Email from queue and Email From User:

For email notifications only: Select the "From" Queue or User that the email should originate from. Ensure that this user or queue can send emails successfully in the system.

Title:

This is used for Task and In App notifications, as well as Email notifications if no email template is selected. You can specify the title of the notification and include dynamic values.

Body:

Body is a multiline text field. It's similar to title field and holds the task description and app notification body (and email body if no template is selected). It can also include dynamic values.

- Dynamic values:

For dynamic values, use the following notation in the field: {fieldname|defaultvalue} Where fieldname is the schema name of a field included in your fetchxml query. It can be an aliased field too, by specifying the linked entity alias, e.g account.name. "defaultvalue" is the value used if the field does not exist or is blank. For example, you could have a title of "Notification for {account.name|an account}", which will look like "Notification for ADatum" or "Notification for an account".

You must ensure that all fields used as dynamic values are included in your fetchxml as attributes, otherwise they will be replaced with the default value.

Example:

Dear {systemuser.fullname|user},
This is an entity Notification. 
Contract Description: {klevr_description|Description is blank}
Thanks,
Klevr Team

If you want to have a { character in the actual text, you can "escape" it by using two brackets, e.g. "Please use {{ and } on the form" will be rendered as "Please use { and } on the form" in the notification, and will not cause the contents inside the { } to be processed as a dynamic field.

Inner Workings

The Notification process runs daily by cloud flow. You can configure the time it should run by editing the flow. Ensure it is configured for your timezone. Ensure the flow is activated, and have a valid connection. The flow will call a custom API to handle the processing, checksum generation and notification creation.

Last updated on