サンプル通知スクリプト
このトピックでは、様々なオブジェクトで使用できるサンプル通知スクリプトについて説明します。 これらは参照用です。 ユーザー独自のビジネス要件があると、異なるスクリプトを使用する場合があります。
アカウントのサンプル・スクリプト
アカウント・オブジェクトのサンプル・スクリプトを次に示します。
ユース・ケース1: 新しいアカウントが割り当てられたことを、アカウントの所有者に通知します
通知およびナビゲーション詳細
-
通知情報: New account: <アカウント名>
-
送信先: アカウントの所有者
-
ユーザーのナビゲート先: アカウント詳細ページ
タイプ
データベースでの挿入の前
スクリプト
/def upID = adf.util.getUserPartyId(); if (isAttributeChanged('OwnerPartyId') && OwnerPartyId!=upID) { try { def map = new HashMap(); // Specifying the recipient def recipientPartyId = OwnerPartyId // Specify default MessageText def messageText = "New Account : '" + OrganizationName + "'." // Specify one or more channels map.put("Channels",["ORA_SVC_BELL"]); map.put("MessageText", messageText); // The following can be used to pass a Long PartyId map.put("RecipientPartyId", recipientPartyId); if (recipientPartyId) { // Call to send notification adf.util.sendNotification(adf, map)
ユース・ケース2: 別のユーザーがアカウント所有者として割り当てられたことを、アカウントの所有者に通知します
通知およびナビゲーション詳細
-
通知情報: Account assigned: <アカウント名>
-
送信先: アカウントの所有者
-
ユーザーのナビゲート先: アカウント詳細ページ
タイプ
データベースでの更新の前
スクリプト
/if (isAttributeChanged('OwnerPartyId')) { try { def map = new HashMap(); // Specifying the recipient def recipientPartyId = OwnerPartyId // Specify default MessageText def messageText = "Account Assigned: '" + OrganizationName + "'." // Specify one or more channels map.put("Channels",["ORA_SVC_BELL"]); map.put("MessageText", messageText); // The following can be used to pass a Long PartyId map.put("RecipientPartyId", recipientPartyId); if (recipientPartyId) { // Call to send notification adf.util.sendNotification(adf, map)
アクティビティのサンプル・スクリプト
アクティビティ・オブジェクトのサンプル・スクリプトを次に示します。
ユース・ケース: タスクが割り当てられたときに、タスクの割当先に通知します
通知およびナビゲーション詳細
-
通知情報: Task assigned: <タスク名>
-
送信先: 割当先
-
ユーザーのナビゲート先: タスク詳細ページ
タイプ
データベースでの更新の前
スクリプト
/if (isAttributeChanged('OwnerId') && ActivityFunctionCode == 'TASK') { try { def map = new HashMap(); def messageText = "Task assigned: " def recipientPartyId = OwnerId // Specify one or more channels map.put("Channels",["ORA_SVC_BELL"]); // Specify default MessageText map.put("MessageText", messageText); // The following can be used to pass a Long PartyId map.put("RecipientPartyId", recipientPartyId); if (recipientPartyId) { adf.util.sendNotification(adf, map) } else { println("No Owner associated with this Task") } } catch (e) { throw new oracle.jbo.ValidationException('Failure to trigger Notification from Groovy Script: ' + e.getMessage()) } }
担当者のサンプル・スクリプト
担当者オブジェクトのサンプル・スクリプトを次に示します。
ユース・ケース1: 新しい担当者が割り当てられたことを、担当者の所有者に通知します
通知およびナビゲーション詳細
-
通知情報: New contact: <担当者名>
-
送信先: 担当者の所有者
-
ユーザーのナビゲート先: 担当者詳細ページ
タイプ
データベースでの挿入の前
スクリプト
/def upID = adf.util.getUserPartyId(); if (isAttributeChanged('OwnerPartyId') && OwnerPartyId!=upID) { try { def map = new HashMap(); // Specifying the recipient def recipientPartyId = OwnerPartyId // Specify default MessageText def messageText = "New Contact: '" + PersonName + "'." // Specify one or more channels map.put("Channels",["ORA_SVC_BELL"]); map.put("MessageText", messageText); // The following can be used to pass a Long PartyId map.put("RecipientPartyId", recipientPartyId); if (recipientPartyId) { // Call to send notification adf.util.sendNotification(adf, map)
ユース・ケース2: 別のユーザーが担当者所有者として割り当てられたことを、担当者の所有者に通知します
通知およびナビゲーション詳細
-
通知情報: Contact assigned: <担当者名>
-
送信先: 担当者の所有者
-
ユーザーのナビゲート先: 担当者詳細ページ
タイプ
データベースでの更新の前
スクリプト
/ if (isAttributeChanged('OwnerPartyId')) { try { def map = new HashMap(); // Specifying the recipient def recipientPartyId = OwnerPartyId // Specify default MessageText def messageText = "Contact Assigned: '" + PersonName + "'." // Specify one or more channels map.put("Channels",["ORA_SVC_BELL"]); map.put("MessageText", messageText); // The following can be used to pass a Long PartyId map.put("RecipientPartyId", recipientPartyId); if (recipientPartyId) { // Call to send notification adf.util.sendNotification(adf, map)
コンテストおよび目標のサンプル・スクリプト
コンテストおよび目標オブジェクトのサンプル・スクリプトを次に示します。
ユース・ケース1: コンテストが作成されたことを、コンテストの関係者に通知します
通知およびナビゲーション詳細
-
通知情報: Contest created: <コンテスト名>
-
送信先: コンテスト関係者
-
ユーザーのナビゲート先: コンテスト詳細ページ
タイプ
データベースでの挿入の前
スクリプト
/def map = new HashMap(); // Specify one or more channels map.put("Channels",[ "ORA_SVC_BELL"]); // Specify default MessageText def messageText = "Contest created: " + ContestName; map.put("MessageText", messageText); // The following can be used to pass a Long PartyId map.put("RecipientPartyId", OwnerId); adf.util.sendNotification(adf, map)
ユース・ケース2: 新しい目標が作成されたことを、目標関係者に通知します
通知およびナビゲーション詳細
-
通知情報: Goal created: <目標名>
-
送信先: 関係者
-
ユーザーのナビゲート先: 目標詳細ページ
タイプ
データベースでの更新の前
スクリプト
// Specify one or more channels map.put("Channels",["ORA_SVC_BELL"]); // Specify default MessageText map.put("MessageText", messageText); // The following can be used to pass a Long PartyId map.put("RecipientPartyId", recipientPartyId); if (recipientPartyId) { adf.util.sendNotification(adf, map) } else { println("No Owner associated with this Goal") } } catch (e) { throw new oracle.jbo.ValidationException('Failure: ' + e.getMessage()) } }
リードのサンプル・スクリプト
リード・オブジェクトのサンプル・スクリプトを次に示します。
ユース・ケース1: 新しいリードが割り当てられたことを、リード所有者に通知します
通知およびナビゲーション詳細
-
通知情報: Lead assigned: <リード名>
-
送信先: 所有者
-
ユーザーのナビゲート先: リード詳細ページ
タイプ
データベースでの更新の前
スクリプト
/if (isAttributeChanged('OwnerId')) { try { def map = new HashMap(); def messageText = "Lead Assigned: " + Name def recipientPartyId = OwnerId // Specify one or more channels map.put("Channels",["ORA_SVC_BELL"]); // Specify default MessageText map.put("MessageText", messageText); // The following can be used to pass a Long PartyId map.put("RecipientPartyId", recipientPartyId); if (recipientPartyId) { adf.util.sendNotification(adf, map) } else { println("No Owner associated with this Lead") } } catch (e) { throw new oracle.jbo.ValidationException('Failure: ' + e.getMessage()) } }
ユース・ケース2: リード所有者にリードが割り当てられているが、サインインしているユーザーのuserPartyIdがリードのリード所有者のものと異なる場合に、リード所有者に通知します
通知およびナビゲーション詳細
-
通知情報: New lead: <リード名>
-
送信先: 所有者
-
ユーザーのナビゲート先: リード詳細ページ
タイプ
データベースでの挿入の前
スクリプト
/def upID = adf.util.getUserPartyId(); if (isAttributeChanged('OwnerId') && OwnerId!=upID) { try { def map = new HashMap(); def messageText = "New Lead: " + Name def recipientPartyId = OwnerId// Specify one or more channels map.put("Channels",["ORA_SVC_BELL"]); // Specify default MessageText map.put("MessageText", messageText); // The following can be used to pass a Long PartyId map.put("RecipientPartyId", recipientPartyId);if (recipientPartyId) { adf.util.sendNotification(adf, map) } else { println("Notification is not sent as Owner of this Lead: "+ Name + " is same as logged in user"); } } catch (e) { throw new oracle.jbo.ValidationException('Failure: ' + e.getMessage()) } }
商談のサンプル・スクリプト
商談オブジェクトのサンプル・スクリプトを次に示します。
ユース・ケース1: 商談が割り当てられたときに、商談所有者に通知します
通知およびナビゲーション詳細
-
通知情報: Opportunity assigned: <商談名>
-
送信先: 所有者
-
ユーザーのナビゲート先: 商談詳細ページ
タイプ
データベースでの更新の前
スクリプト
/if (isAttributeChanged('OwnerResourcePartyId')) { try { def map = new HashMap(); def messageText = "Opportunity Assigned: " + Name def recipientPartyId = OwnerResourcePartyId // Specify one or more channels map.put("Channels",["ORA_SVC_BELL"]); // Specify default MessageText map.put("MessageText", messageText); // The following can be used to pass a Long PartyId map.put("RecipientPartyId", recipientPartyId); if (recipientPartyId) { adf.util.sendNotification(adf, map) } else { println("No Owner associated with this Opportunity") } } catch (e) { throw new oracle.jbo.ValidationException('Failure: ' + e.getMessage()) } }
ユース・ケース2: 商談所有者に商談が割り当てられているが、サインインしているユーザーのuserPartyIdが商談所有者のものと異なる場合に、商談所有者に通知します
通知およびナビゲーション詳細
-
通知情報: New opportunity: <商談名>
-
送信先: 所有者
-
ユーザーのナビゲート先: 商談詳細ページ
タイプ
データベースでの挿入の前
スクリプト
/def upID = adf.util.getUserPartyId(); if (isAttributeChanged('OwnerResourcePartyId') && OwnerResourcePartyId!=upID) { try { def map = new HashMap(); def messageText = "New Opportunity: " + Name def recipientPartyId = OwnerResourcePartyId // Specify one or more channels map.put("Channels",["ORA_SVC_BELL"]); // Specify default MessageText map.put("MessageText", messageText); // The following can be used to pass a Long PartyId map.put("RecipientPartyId", recipientPartyId); if (recipientPartyId) { adf.util.sendNotification(adf, map) } else { println("Notification is not sent as Owner of this Opportunity: "+ Name + " is same as logged in user"); } } catch (e) { throw new oracle.jbo.ValidationException('Failure: ' + e.getMessage()) } }