4.3.3.1 Example of notification of schedule and work item origin
The following are use cases of notification conditions triggered based on schedule and work items.
Clicking each use case number will take you to the description of the use case.
(Table) Examples of notification conditions based on schedule and work items
| Use cases | Trigger | Notification condition |
|---|---|---|
| 1 | Work item | Notifies of work item creation and updates. However, if only the display order of work items is changed, no notification is made. |
| 2 | Schedule | Notification of change of schedule agent. |
| 3 | Notification of reminders 5 and 60 minutes before the start of the schedule. | |
| 4 | Notification of changes to specific schedules tied to recurring work. |
Notes
When using the schedule as a starting point, note the following.
- The "title" value of the schedule tied to a work item will always be empty. To obtain the name of the schedule, refer to ".Context.workitem.name" instead of ".Context.title".
- For schedules tied to work items, the information of the agent is set to "assignedUsers". Additionally, for schedules not tied to work items, the information of the agent is set to "assignedTo".
For this reason, when specifying the agent or name in the body of the notification or the recipient of the notification, create separate YAML definitions for the Notification for the schedule tied to the work item and for the schedule not tied to the work item. - If you have been using the notification function before the work item management function is supported, add the following to the notification conditions of the registered YAML definition before using the work item management function to prevent unintended notifications due to work item creation or updates.
- resource: '{{ .GetValue ".Context.workitem" }}'
eq: ""
An example of Notification YAML definitions for each use case is shown below. For details on the YAML definitions, see “Notification, Notifier”.
[Use case 1: Notify of work item creation and updates]
When work items are created and updated, information such as the work item name and the agent is notified. In the following definition example, no notification is made when a work item with an empty start date is created and updated. Therefore, if the following operation is performed, a work item will be created, but no notification will be made.
- Copying calendar
- Copying work item
- Creating calendar using a template
apiVersion: 1.0
kind: notification
type: resource
name: sample_notification_work-item
label: Notification sample 1
description: Notification regarding create or update work-item
event:
resource: workitem
type: update
conditions:
-
- resource: '{{ .GetValue ".Context.startDate" }}'
ne: ""
notifications:
- message:
title: '[{{ .GetValue ".Context.name" }}] has been updated.'
body: |
The work-item {{ .GetValue ".Context.name" }} has been updated.
Information:
planned start time: "{{ .GetValue ".Context.plannedStart" }}"
assignedUsers: "{{ .GetValue ".Context.assignedUsers.name" }}"
assignedGroup: "{{ .GetValue ".Context.assignedGroup.name" }}"
destinations:
- type: groupMember
value: '{{ .GetValue ".Context.assignedGroup.id" }}'
[Use case 2: Notify of change of schedule agent]
Notifies of schedule agent changes.
Separate definitions are created for schedules that are tied to work items and schedules that are not tied to work items.
①For schedules tied to work items
apiVersion: 1.0
kind: notification
type: resource
name: sample_notification_assigned_to_me_1
label: Notification sample 2-1
description: Notification regarding new assignments for a schedule related to work-item
event:
resource: schedule
type: update # Notification by schedule update
conditions:
-
- resource: '{{ .GetValue ".Context.assignedUsers" }}' # When schedule agent is changed
ne: '{{ .GetValue ".PrevContext.assignedUsers" }}'
- resource: '{{ .GetValue ".Context.workitem" }}'
ne: ""
notifications:
- message:
title: "New assignment"
body: |
Schedule {{ .GetValue ".Context.workitem.name" }} is assigned to you.
referTo:
severity: Information
destinations:
- type: user
value: '{{ .GetValue ".Context.assignedUsers" }}'
②In the case of a schedule not tied attached to work items
apiVersion: 1.0
kind: notification
type: resource
name: sample_notification_assigned_to_me_2
label: Notification sample 2-2
description: Notification regarding new assignments for a schedule not related to work-item
event:
resource: schedule
type: update # Notification by schedule update
conditions:
-
- resource: '{{ .GetValue ".Context.assignedTo" }}' # When schedule agent is changed
ne: '{{ .GetValue ".PrevContext.assignedTo" }}'
- resource: '{{ .GetValue ".Context.workitem" }}'
eq: ""
notifications:
- message:
title: "New assignment"
body: |
Schedule {{ .GetValue ".Context.title" }} is assigned to you.
referTo:
severity: Information
destinations:
- type: user
value: '{{ .GetValue ".Context.assignedTo" }}'
[Use case 3: Notify of reminders 5 and 60 minutes before the start of the schedule]
Notifies of reminders 5 and 60 minutes before the start of the schedule.
Separate definitions are created for schedules that are tied to work items and schedules that are not tied to work items. Schedules tied to work items are created 7 days prior to the start date of the work, so reminders can be sent for schedules within 7 days.
①For schedules tied to work items
apiVersion: 1.0
kind: notification
type: resource
name: sample_notification_remind_schedule_before_1
label: Notification sample 3-1
description: Notification for reminder of a schedule related to work-item before start time
event:
resource: schedule
type: time # Notification by periodic monitoring of schedule
conditions:
-
- resource: '{{ .GetValue ".Context.plannedStart" }}' # Notification 5 minutes before schedule start
remaining: 5
- resource: '{{ .GetValue ".Context.workitem" }}'
ne: ""
-
- resource: '{{ .GetValue ".Context.plannedStart" }}' # Notification 60 minutes before schedule start
remaining: 60
- resource: '{{ .GetValue ".Context.workitem" }}'
ne: ""
notifications:
- message:
title: "Assigned schedule reminder 5 and 60 minutes"
body: |
Reminding of your schedule {{ .GetValue ".Context.workitem.name" }}.
Planned start time: {{ .GetValue ".Context.plannedStart" }}
referTo:
severity: Information
destinations:
- type: user
value: '{{ .GetValue ".Context.assignedUsers.id" }}'
②In the case of a schedule not tied attached to work items
apiVersion: 1.0
kind: notification
type: resource
name: sample_notification_remind_schedule_before_2
label: Notification sample 3-2
description: Notification for reminder of a schedule not related to work-item before start time
event:
resource: schedule
type: time # Notification by periodic monitoring of schedule
conditions:
-
- resource: '{{ .GetValue ".Context.plannedStart" }}' # Notification 5 minutes before schedule start
remaining: 5
- resource: '{{ .GetValue ".Context.workitem" }}'
eq: ""
-
- resource: '{{ .GetValue ".Context.plannedStart" }}' # Notification 60 minutes before schedule start
remaining: 60
- resource: '{{ .GetValue ".Context.workitem" }}'
eq: ""
notifications:
- message:
title: "Assigned schedule reminder 5 and 60 minutes"
body: |
Reminding of your schedule {{ .GetValue ".Context.title" }}.
Planned start time: {{ .GetValue ".Context.plannedStart" }}
referTo:
severity: Information
destinations:
- type: user
value: '{{ .GetValue ".Context.assignedTo" }}'
[Use case 4: Notify of changes to specific schedules tied to recurring work]
Notifies of changes to specific schedules tied to recurring work.
Schedules tied to work items are created 7 days prior to the start date of the work. For this reason, specific schedules with a work start date of 7 days or less will be subject to notification.
The following definition example sets up a notification condition so that notification is made only when an “individual work item” for a recurring work is changed.
For changes involving an entire recurring work item or changes involving a single work item, use the definition example described in Use Case 1, “Notify of work item creation and updates” to notify of the changes.
apiVersion: 1.0
kind: notification
type: resource
name: sample_notification individual_work
label: Notification sample 4
description: Notification for update individual schedule created by work-item definition
event:
resource: schedule
type: update
conditions:
-
- resource: '{{ .GetValue ".Context.workitem" }}'
ne: ""
- resource: '{{ .GetValue ".Context.changedFromWorkItemDefinition" }}'
eq: "true"
- resource: '{{ .GetValue ".Context.workitem.scheduleType" }}'
ne: oneTime
notifications:
- message:
title: '[{{ .GetValue ".Context.workitem.name" }}] has been updated.'
body: |
The individual work of work-item {{ .GetValue ".Context.workitem.name" }} has been updated.
Individual work Information:
planned start time: "{{ .GetValue ".Context.plannedStart" }}"
assignedUsers: "{{ .GetValue ".Context.assignedUsers.name" }}"
assignedGroup: "{{ .GetValue ".Context.assignedGroup.name" }}"
destinations:
- type: groupMember
value: '{{ .GetValue ".Context.assignedGroup.id" }}'