ヘルプ・デスク・リクエストが解決されました
ヘルプ・デスク・リクエストが解決されたときに、「通知プリファレンス」ページで指定した受信者に通知が送信されるようトリガーするサンプル・コードを次に示します:
ノート:
リクエスト解決のGroovyスクリプトが正しく機能するように、SVC_ENABLE_RESOLVE_SRプロファイル・オプションを設定する必要があります。
このサンプル・スクリプトは、オブジェクトHRヘルプ・デスク・リクエストを使用します。 このスクリプトを内部サービス・リクエストに使用している場合は、オブジェクトを内部サービス・リクエストに変更します。
/* DISCLAIMER: This trigger is provided only as a reference.
* TRIGGER TYPE: Before Update in Database
* OBJECT: HR Help Desk Request
* Use Case: Send a notification to the primary contact when an SR has been resolved.
* Note: You can override the Notification Text and Recipients using the Notification Preferences page.
if (isAttributeChanged('StatusCd')&& StatusCd == 'ORA_SVC_HRHD_RESOLVED') {
try {
def recipientPartyId = PrimaryContactPartyId
def messageText = 'An SR 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 resolved.")
} 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())
}
}