4.3.3.1 スケジュール・作業項目起点の通知例
スケジュール、作業項目を起点とした通知条件のユースケースを以下に示します。
各ユースケースの番号をクリックするとユースケースごとの説明に遷移します。
ユースケース | 起点 | 通知条件 |
---|---|---|
1 | 作業項目 | 作業項目の作成、更新内容を通知する。 ただし作業項目の表示順序のみが変更された場合、通知は行われない。 |
2 | スケジュール | スケジュールの担当者変更を通知する。 |
3 | スケジュールの開始5分前と60分前にリマインダーを通知する。 | |
4 | 定期的な作業にひもづく特定のスケジュールの変更を通知する。 |
注意事項
スケジュールを起点にする場合は以下に注意してください。
- 作業項目にひもづくスケジュールの「title」の値は常に空になります。スケジュールの名前を取得するには、「.Context.title」ではなく、「.Context.workitem.name」を参照してください。
- 作業項目にひもづくスケジュールの場合、担当者の情報は「assignedUsers」に設定されます。また、作業項目にひもづかないスケジュールの場合、担当者の情報は「assignedTo」に設定されます。
このため、通知の本文や通知先に担当者や名前を指定する場合、作業項目にひもづくスケジュールとひもづかないスケジュールで、 NotificationのYAML定義をそれぞれ別々に作成してください。 - 作業項目管理機能がサポートされる前から通知機能を利用している場合、作業項目管理機能を利用する前に登録済みのYAML定義の通知条件に次の内容を追加して、作業項目の作成や更新による意図しない通知が行われないようにしてください。
- resource: '{{ .GetValue ".Context.workitem" }}'
eq: ""
各ユースケースについての、NotificationのYAML定義例を以下に示します。YAML定義の詳細は「Notification、Notifier」を参照してください。
【ユースケース1:作業項目の作成、更新内容を通知する】
作業項目の作成と更新時に、作業項目名や担当者などの情報を通知します。 次に示す定義例では、開始日が空の作業項目の作成と更新時には通知が行われません。このため、次の操作を行った場合、作業項目は作成されますが、通知は行われません。
- カレンダーのコピー
- 作業項目のコピー
- テンプレートを利用したカレンダーの作成
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" }}'
【ユースケース2:スケジュールの担当者変更を通知する】
スケジュールの担当者変更を通知します。
作業項目にひもづくスケジュールと作業項目にひもづかないスケジュールで別々に定義を作成します。
①作業項目にひもづくスケジュールの場合
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 # スケジュールの更新による通知
conditions:
-
- resource: '{{ .GetValue ".Context.assignedUsers" }}' # スケジュールの担当者を変更したとき
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" }}'
②作業項目にひもづかないスケジュールの場合
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 # スケジュールの更新による通知
conditions:
-
- resource: '{{ .GetValue ".Context.assignedTo" }}' # スケジュールの担当者を変更したとき
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" }}'
【ユースケース3:スケジュールの開始5分前と60分前にリマインダーを通知する】
スケジュールの開始5分前と60分前にリマインダーを通知します。
作業項目にひもづくスケジュールと作業項目にひもづかないスケジュールで別々に定義を作成します。作業項目にひもづくスケジュールは、作業開始日の7日前に作成されるため、7日以内のスケジュールに対して、リマインダーを通知できます。
①作業項目にひもづくスケジュールの場合
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 # スケジュールの定期監視による通知
conditions:
-
- resource: '{{ .GetValue ".Context.plannedStart" }}' # スケジュールの開始5分前に通知
remaining: 5
- resource: '{{ .GetValue ".Context.workitem" }}'
ne: ""
-
- resource: '{{ .GetValue ".Context.plannedStart" }}' # スケジュールの開始60分前に通知
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" }}'
②作業項目にひもづかないスケジュールの場合
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 # スケジュールの定期監視による通知
conditions:
-
- resource: '{{ .GetValue ".Context.plannedStart" }}' # スケジュールの開始5分前に通知
remaining: 5
- resource: '{{ .GetValue ".Context.workitem" }}'
eq: ""
-
- resource: '{{ .GetValue ".Context.plannedStart" }}' # スケジュールの開始60分前に通知
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" }}'
【ユースケース4:定期的な作業にひもづく特定のスケジュールの変更を通知する】
定期的な作業にひもづく特定のスケジュールの変更を通知します。
作業項目にひもづくスケジュールは、作業開始日の7日前に作成されます。このため、作業開始日が7日以内の特定のスケジュールが通知の対象になります。
次の定義例は、定期的な作業に対する「個別の作業項目」を変更した場合にのみ通知が行われるように通知条件を設定しています。
定期的な作業項目の全体に関わる変更や単一の作業項目の変更については、ユースケース1「作業項目の作成、更新内容を通知する」に記載した定義例で、変更内容を通知してください。
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" }}'