機械翻訳について

通知のサンプルGroovyスクリプト

Groovyスクリプトを使用して、通知の開始を定義します。 営業オブジェクトの「通知プリファレンス」ページで指定した受信者への通知を生成するサンプル・コードを次に示します。 これらのスクリプトは、必要に応じて変更できます。

標準オブジェクトのスクリプト

次に、標準営業オブジェクトのサンプル・スクリプトを示します。

オブジェクト

シナリオ

作成および割当のスクリプト

アカウント

プッシュ通知の受信

アカウントの作成

// Send notification to Owner when Account is created // Use trigger type BEFORE INSERT TO DATABASE def map = new HashMap(); // Specify one or more channels map.put("Channels",["ORA_SVC_BELL"]); // Specify default MessageText def messageText = "Account created with name: " + OrganizationName; map.put("MessageText", messageText); // The following can be used to pass a Long PartyId map.put("RecipientPartyId", OwnerPartyId); adf.util.sendNotification(adf, map)

アカウント

詳細ページへのドリルダウン

アカウントの割当

// Send notification to Owner when Account is assigned to them // Use trigger type BEFORE UPDATE TO DATABASE if (isAttributeChanged('OwnerPartyId')) { try { def map = new HashMap(); def messageText = "This Account has been assigned to you" def recipientPartyId = OwnerPartyId // 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 Account") } } catch (e) { throw new oracle.jbo.ValidationException('Failure: ' + e.getMessage()) } }

担当者

プッシュ通知の受信

担当者の作成

// Send notification to Owner when Contact is created // Use trigger type BEFORE INSERT TO DATABASE def map = new HashMap(); // Specify one or more channels map.put("Channels",[ "ORA_SVC_BELL"]); // Specify default MessageText def messageText = "Contact created with name: " + PersonName; map.put("MessageText", messageText); // The following can be used to pass a Long PartyId map.put("RecipientPartyId", OwnerPartyId); adf.util.sendNotification(adf, map)

担当者

詳細ページへのドリルダウン

担当者の割当

// Send notification to Owner when Contact is assigned to them // Use trigger type BEFORE UPDATE TO DATABASE if (isAttributeChanged('OwnerPartyId')) { try { def map = new HashMap(); def messageText = "This Contact has been assigned to you" def recipientPartyId = OwnerPartyId // 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 Contact") } } catch (e) { throw new oracle.jbo.ValidationException('Failure: ' + e.getMessage()) } }

リード

プッシュ通知の受信

リードの作成

// Send notification to Owner when Lead is created // Use trigger type BEFORE INSERT TO DATABASE def map = new HashMap(); //give lead object API name def objectCode = 'MklLeadVO' map.put("ObjectCode", objectCode) // Specify one or more channels map.put("Channels",["ORA_SVC_BELL"]); // Specify default MessageText def messageText = "Lead created with name: " + Name; map.put("MessageText", messageText); // The following can be used to pass a Long PartyId map.put("RecipientPartyId", OwnerId); adf.util.sendNotification(adf, map);

リード

詳細ページへのドリルダウン

リードの割当

Lead Assign // Send notification to Owner when Lead is assigned to them // Use trigger type BEFORE UPDATE TO DATABASE if (isAttributeChanged('OwnerId')) { try { def map = new HashMap(); def messageText = "This Lead has been assigned to you" 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()) } }

商談

プッシュ通知の受信

商談の作成

// Send notification to Owner when Opportunity is created // Use trigger type BEFORE INSERT TO DATABASE def map = new HashMap(); // Specify one or more channels map.put("Channels",["ORA_SVC_BELL"]); // Specify default MessageText def messageText = "Opportunity created with name: " + Name; map.put("MessageText", messageText); // The following can be used to pass a Long PartyId map.put("RecipientPartyId", OwnerResourcePartyId); adf.util.sendNotification(adf, map)

商談

詳細ページへのドリルダウン

商談の割当

// Send notification to Owner when Opportunity is assigned to them // Use trigger type BEFORE UPDATE TO DATABASE if (isAttributeChanged('OwnerResourcePartyId')) { try { def map = new HashMap(); def messageText = "This Opportunity has been assigned to you" 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()) } }
ヒント: これらのスクリプトでは、グローバル・ヘッダーのベル・アイコンのみを有効にします。 他のチャネル(ブラウザやモバイルなど)の通知を有効にするには、次の構文を使用: // Specify one or more channels map.put("Channels",["ORA_SVC_BELL", "ORA_SVC_OMNI","ORA_SVC_MOBILE"]););
  • ORA_SVC_BELL: グローバル・ヘッダーの通知アイコン

  • ORA_SVC_OMNI: ブラウザの通知アイコン

  • ORA_SVC_MOBILE: モバイル通知

カスタム・オブジェクトのスクリプト

Groovyスクリプトを使用して、カスタム・オブジェクトの通知を送信できます。

前提条件:

  • グローバル関数adf.util.sendNotification (adf, map)を使用します。

  • ObjectCodeは、Groovyトリガーのリクエスト・パラメータ・ハッシュ・マップの一部として明示的に渡す必要があります。

  • カスタム・オブジェクトを公開する必要があります。

オブジェクト

シナリオ

作成および割当のスクリプト

カスタム・オブジェクト

ユーザーのパーティIDに基づいたユーザーへのベル通知送信

try { Long recipientPartyId = 100010037456865 def messageText = 'A custom object notification (default message).' def objectCode='CustomObject_SR_c' def map = new HashMap(); map.put("Channels", ["ORA_SVC_BELL"]); map.put("MessageText", messageText); map.put("RecipientPartyId", recipientPartyId); map.put("ObjectCode", objectCode); adf.util.sendNotification(adf,map) println("Triggered a notification"); } 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()); }

カスタム・オブジェクトのオブジェクト・コードを検索するには、オブジェクトの概要ページにナビゲートします。 API名は、そのページの「オブジェクト情報」リージョンにリストされます。