関数とGroovy式

このトピックでは、アラート・コンポーザを使用してアラートを構成するときに使用できる、様々な関数およびGroovy式について説明します。

個人の戻り属性には、次のいずれかを指定できます。

  • PersonId

  • WorkEmail

  • DisplayName

  • FirstName

  • LastName

  • UserName

関数

この表は、アラートでサポートされている関数を示しています。最大25個の結果が取得されます。結果が25個を超えると、警告メッセージがログに表示されます。

関数

説明

使用方法

  • 名前: hrRepList

  • 表示名: 人事担当者

PersonIdのHR担当者個人属性を返します。

「受信者」セクション

Eメール: ${AlertUtils.toString(AlertUtils.hrRepList(workers.PersonId).WorkEmail)}

ユーザー名: ${AlertUtils.toString(AlertUtils.hrRepList(workers.PersonId).UserName)}

「本文」または「件名」セクション

名前: ${AlertUtils.hrRepList(workers.PersonId).FirstName)}

名前: ${AlertUtils.toString(AlertUtils.hrRepList(workers.PersonId).FirstName)}

ループの例

名前: ${AlertUtils.loop('workers','${AlertUtils.toString(AlertUtils.hrRepList(workers.PersonId).FirstName)}')}

「受信者」セクション

Eメール: Christopher.Brown@example.com,William.Jones@example.com

ユーザー名: Christopher.Brown,William.Jones

「本文」または「件名」セクション

名前: [Christopher,William]

名前: Christopher,William

ループの例

名前: Christopher,William

  • 名前: payRepList

  • 表示名: 給与担当者

PersonIdの給与担当者個人属性を返します。

「受信者」セクション

Eメール: ${AlertUtils.toString(AlertUtils.payRepList(workers.PersonId).WorkEmail)}

ユーザー名: ${AlertUtils.toString(AlertUtils.payRepList(workers.PersonId).UserName)}

「本文」または「件名」セクション

名前: ${AlertUtils.toString(AlertUtils.payRepList(workers.PersonId).FirstName)}

ループの例

名前: ${AlertUtils.loop('workers','${AlertUtils.toString(AlertUtils.payRepList(workers.PersonId).FirstName)}')}

「受信者」セクション

Eメール: Christopher.Brown@example.com,William.Jones@example.com

ユーザー名: Christopher.Brown,William.Jones

「本文」または「件名」セクション

名前: Christopher,William

ループの例

名前: Christopher,William

  • 名前: benRepList

  • 表示名: 福利厚生担当者

PersonIdの福利厚生担当者個人属性を返します。

「受信者」セクション

Eメール: ${AlertUtils.toString(AlertUtils.benRepList(workers.PersonId).WorkEmail)}

ユーザー名: ${AlertUtils.toString(AlertUtils.benRepList(workers.PersonId).UserName)}

「本文」または「件名」セクション

名前: ${AlertUtils.toString(AlertUtils.benRepList(workers.PersonId).FirstName)}

ループの例

名前: ${AlertUtils.loop('workers','${AlertUtils.toString(AlertUtils.benRepList(workers.PersonId).FirstName)}')}

「受信者」セクション

Eメール: Christopher.Brown@example.com,William.Jones@example.com

ユーザー名: Christopher.Brown,William.Jones

「本文」または「件名」セクション

名前: Christopher,William

ループの例

名前: Christopher,William

  • 名前: unionRepList

  • 表示名: 組合代表

PersonIdの組合代表個人属性を返します。

「受信者」セクション

Eメール: ${AlertUtils.toString(AlertUtils.unionRepList(workers.PersonId).WorkEmail)}

ユーザー名: ${AlertUtils.toString(AlertUtils.unionRepList(workers.PersonId).UserName)}

「本文」または「件名」セクション

名前: ${AlertUtils.toString(AlertUtils.unionRepList(workers.PersonId).FirstName)}

ループの例

名前: ${AlertUtils.loop('workers','${AlertUtils.toString(AlertUtils.unionRepList(workers.PersonId).FirstName)}')}

「受信者」セクション

Eメール: Christopher.Brown@example.com,William.Jones@example.com

ユーザー名: Christopher.Brown,William.Jones

「本文」または「件名」セクション

名前: Christopher,William

ループの例

名前: Christopher,William

  • 名前: empManagerList

  • 表示名: 従業員マネージャ

PersonIdの従業員のマネージャ個人属性を返します。

「受信者」セクション

Eメール: ${AlertUtils.toString(AlertUtils.empManagersList(workers.PersonId).WorkEmail)}

ユーザー名: ${AlertUtils.toString(AlertUtils.empManagersList(workers.PersonId).UserName)}

「本文」または「件名」セクション

名前: ${AlertUtils.toString(AlertUtils.empManagersList(workers.PersonId).FirstName)}

「受信者」セクション

Eメール: Diane.Brown@example.com

ユーザー名: Diane.Brown

「本文」または「件名」セクション

名前: Diane

  • 名前: roleMemberList

  • 表示名: ロール別のロール・メンバー

指定されたロール・コードの特定のロールに割り当てられているすべてのアクティブ・ユーザーを返します。

「受信者」セクション

指定されたRole_NameまたはRole_Codeが割り当てられている個人詳細を持つユーザーを返します

Eメール: ${AlertUtils.toString(AlertUtils.roleMemberList("CUSTOM_X_JOB_ROLE_CODE").WorkEmail)}

ユーザー名: ${AlertUtils.toString(AlertUtils.roleMemberList("CUSTOM_X_JOB_ROLE_CODE").UserName)}

「本文」または「件名」セクション

名前: ${AlertUtils.toString(AlertUtils.roleMemberList("CUSTOM_X_JOB_ROLE_CODE").FirstName)}

「受信者」セクション

Eメール: Christopher.Brown@example.com,William.Jones@example.com

ユーザー名: Christopher.Brown,William.Jones

「本文」または「件名」セクション

名前: Christopher,William

  • 名前: toString

  • 表示名: なし

オブジェクトの配列をカンマ区切り文字列に変換します。

${workRelationships.assignments.AssignmentName}

${AlertUtils.toString(workRelationships.assignments.AssignmentName)}

[Assignment A, Assignment B]

Assignment A, Assignment B

  • 名前: person

  • 表示名: 個人詳細

PersonIdの個人属性を返します。

個人名は ${AlertUtils.person(workers.PersonId).DisplayName}

個人名は Edward

  • 名前: getSysdate

  • 表示名: システム日付

システム日付を返します。

${AlertUtils.getSysdate()}

2016-04-25

  • 名前: getSystimestamp

  • 表示名: システム・タイム・スタンプ

システムの日付と時刻を返します。

${AlertUtils.getSystimestamp()}

2016-04-25 23:44:52.0

  • 名前: formatNumber

  • 表示名: フォーマット番号

指定されたJava数値書式に数値を書式設定します。サポートされている書式は、https://docs.oracle.com/javase/7/docs/api/java/text/NumberFormat.html.を参照してください

試用期間は ${AlertUtils.formatNumber(workers.workRelationships.assignments[0].ProbationPeriod, '9,999,999')} 日です

使用期間は 240 日です

  • 名前: formatDate

  • 表示名: フォーマット日付

指定されたJava日付書式に日付を書式設定します。サポートされている書式は、https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.htmlを参照してください。

ノート: 指定する日付は、Application Developer Framework (ADF) REST応答のデフォルトの日付書式である、[yyyy-MM-dd]書式である必要があります。

日付: ${AlertUtils.formatDate(workers.workRelationships.assignments.ProbationEndDate, 'dd-MMM-yyyy')}

日付: [30-Mar-2022]

名前: getLookupMeaning

ユーザーのプリファレンス言語に基づいて参照の意味を返します。

Lookup meaning ${AlertUtils.getLookupMeaning(<LookupType>,<LookupCode>)}

${AlertUtils.getLookupMeaning('YES_NO','Y')}

はい

名前: getLookupMeaning

国別仕様ストライプに対するユーザーのプリファレンス言語に基づいて、参照の意味を返します

${AlertUtils.getLookupMeaning(<LookupType>,<LookupCode>, <LegislationCode>)}

${AlertUtils.getLookupMeaning('GENDER','M','US')}

男性

  • 名前: loop

  • 表示名: ループ

コレクションをループします。この関数は、次のようにメッセージ・コンテンツ内に表を作成するために使用できます。

${AlertUtils.loop('ResourceName1,ResourceName2' , 'Content1','Content2')}

リソース名はカンマで区切られ、その後に指定されるコンテンツは指定された順序でデータを追加するために使用されます。各ResourceName1レコードに対し、ResourceName2の対応するコンテンツが追加されます。これはネストされた方法で行われます。

ルール

  • リソース名のリストは階層順にする必要があります。すべての子リソースの前に親リソースを指定する必要があります(ルート・レベルの子リソースの場合を除く)。

    たとえば、ルートがworkers、子がworkRelationships、孫がassignmentsである階層を考えます。assignmentsでループを作成するには、workRelationshipsリソースもAPIに含める必要があります。

    ${AlertUtils.loop('workRelationships,assignments','<tr><td>${AssignmentNumber}</td>','<td>${Name}</td></tr>')}

  • 各レベルの属性を直接参照できます。式${parentResourceName.AttributeName}を使用すると、子コンテンツ内で親属性にアクセスできます。

    例: ${workers.PersonId}

サンプル1

${FirstName}さんこんにちは。

次の30日間に、この従業員のビザが失効します。

<table>

${AlertFct.loop('visas','<tr><td>${IssuingCountry}</td><td>${VisaPermitNumber}</td></tr>')}

</table>

よろしくお願いいたします。

サンプル2

${FirstName}さんこんにちは。

次の30日間に、この従業員のビザが失効します。

<table>

${AlertUtils.loop('workers,visasPermits','<tr><td>${workers.DisplayName}</td>','<td>${IssuingCountry} </td><td>${ExpirationDate}</td></tr>')}

</table>

よろしくお願いいたします。

サンプル1

Johnさんこんにちは。

次の30日間に、この従業員のビザが失効します。


US		NBC-88457
US		234234

よろしくお願いいたします。

サンプル2

Johnさんこんにちは。

次の30日間に、この従業員のビザが失効します。

Name		Issuing Country		Expiration Date
Employee1		US		2016-03-14
Employee1		IN		2016-03-20
Employee2		US		2016-02-18
Employee3		US		2015-05-01
Employee4		US		2015-12-14
Employee5		US		2015-05-17
Employee5		UK		2015-09-17

よろしくお願いいたします。

Groovy式

アラート・コンポーザでは、変数の置換および実行時に指定された値に基づく条件の追加を行うGroovy式がサポートされています。次の表に、いくつかの例を示します。

Groovy式

こんにちは ${AlertUtils.toString(workers.names.LastName)} さん

${AlertUtils.toString(visasPermits.IssuingCountry)} で発行されたあなたのビザが ${AlertUtils.toString(visasPermits.ExpirationDate)} に失効します。

こんにちは John さん

GB, USで発行されたあなたのビザが2022-03-10, 2022-01-11に失効します。

こんにちは ${AlertUtils.toString(workers.names.LastName)} さん

<%

asgStr ="";

for(visaPermit in visasPermits)

{

asgStr = asgStr + visaPermit.IssuingCountry+" ";

}

print("従業員: "+asgStrに対して複数のビザが発行されています);

%>

よろしくお願いいたします。

管理者

こんにちは John さん

従業員: GBに対して複数のビザが発行されています

よろしくお願いいたします。

管理者