期限切れのマイルストン・サンプル・スクリプトを表示できますか。
これは、マイルストンの期限が切れるときに「通知プリファレンス」ページで指定した受信者に通知を送信するトリガーとなるサンプル・コードです。
このサンプル・コードは、「アプリケーション・コンポーザ」>「オブジェクト」>「標準オブジェクト」>「サービス・リクエスト」>「マイルストン」>「サーバー・スクリプト」でコピーおよびペーストできます。
ノート: この例では、
WarnedFlag
を使用します。 ただし、同様の結果にComplianceFlag
を使用することもできます。 /* DISCLAIMER: This trigger is provided only as a reference.
* TRIGGER TYPE: Before Update in Database
* OBJECT: Milestone (child of Service Request)
* Use Case: Send a notification to the assignee when an SR milestone is expiring.
* Note: You can override the Notification Text and Recipients using the Notification Preferences page.
*/
if (isAttributeChanged('WarnedFlag') && WarnedFlag=='Y') {
try {
def recipientPartyId = SrAssigneePartyId
def messageText = 'An SR milestone notification (default message).'
if (recipientPartyId) {
//Call to send notification
adf.util.sendNotification(adf, messageText, recipientPartyId)
//Log a confirmation that the notification has been sent. Logs can be viewed in 'Runtime Messages'.
//println("Notification sent to " + recipientPartyId + " because the SR was escalated.")
} else {
println("No Assignee associated with this SR")
}
} catch (e) {
//Log the failure in groovy logging. Logs can be viewed in 'Runtime Messages'.
println("Failure to trigger notification from Groovy Script " + e.getMessage());
// Throwing validation exception will show the message on the UI. This is not recommended for published sandboxes.
// The following code is one of many to illustrate identifying an error in trigger from the UI.
// Replace <triggerName> with the trigger name you specified when creating this trigger.
// throw new oracle.jbo.ValidationException('Failure to trigger <triggerName> Notification from Groovy Script: ' + e.getMessage())
}
}