UserProvisioningPlugin クラス
名前空間
使用方法
このクラスを拡張すると、次の入力および出力パラメータを備えたプラグインになり、Flow Designer で Apex プラグインとして使用できます。
| 入力パラメータ名 | 説明 |
|---|---|
| userProvisioningRequestId | プラグインが処理する要求の一意の ID。 |
| userId | 要求の関連付けられているユーザの ID。 |
| NamedCredDevName | 要求に使用する指定ログイン情報の一意の API 名。指定ログイン情報は、サードパーティシステムとサードパーティ認証設定を識別します。 ユーザプロビジョニングウィザードで指定ログイン情報が設定されると、Salesforce によって値が UserProvisioningConfig.NamedCredentialId 項目に保存されます。 |
| reconFilter | サードパーティシステムのユーザを収集して分析するときに、プラグインはこの検索条件を使用して収集範囲を制限します。 ユーザプロビジョニングウィザードで検索条件が設定されると、Salesforce によって値が UserProvisioningConfig.ReconFilter 項目に保存されます。 |
| reconOffset | サードパーティシステムのユーザを収集して分析するときに、プラグインはこの値を収集の開始点として使用します。 |
| 出力パラメータ名 | 説明 |
|---|---|
| Status |
サードパーティシステムでのプロビジョニング操作のベンダ固有の状況。 |
| Details | サードパーティシステムでのプロビジョニング操作の状況に関連するベンダ固有のメッセージ。 |
| ExternalUserId | サードパーティシステムの関連付けられたユーザのベンダ固有の ID。 |
| ExternalUsername | サードパーティシステムの関連付けられたユーザのベンダ固有のユーザ名。 |
| ExternalEmail | サードパーティシステムのユーザに割り当てられたメールアドレス。 |
| ExternalFirstName | サードパーティシステムのユーザに割り当てられた名。 |
| ExternalLastName | サードパーティシステムのユーザに割り当てられた姓。 |
| reconState | サードパーティシステムでの収集および分析プロセスの状態。値が complete のときは、プロセスが終了し、それ以降はプラグインへのコールが必要になることも実行されることもありません。 |
| nextReconOffset | サードパーティシステムのユーザを収集して分析するときに、トランザクションの制限に達し、終了前に停止する必要が生じる場合があります。ここで指定した値により、割り当て制限が刷新されプラグインへのコールが開始されます。 |
他のカスタムパラメータを追加する場合は、buildDescribeCall() メソッドを使用します。
例
次の例では、buildDescribeCall() メソッドを使用して、新しい入力パラメータと新しい出力パラメータを追加します。また、Apex トランザクションの DML ステートメントで処理されるレコード 10,000 件の上限をスキップする方法も示します。
1global class SampleConnector extends UserProvisioning.UserProvisioningPlugin {
2
3 // Example of adding more input and output parameters to those defined in the base class
4 global override Process.PluginDescribeResult buildDescribeCall() {
5 Process.PluginDescribeResult describeResult = new Process.PluginDescribeResult();
6 describeResult.inputParameters = new
7 List<Process.PluginDescribeResult.InputParameter>{
8 new Process.PluginDescribeResult.InputParameter('testInputParam',
9 Process.PluginDescribeResult.ParameterType.STRING, false)
10 };
11
12 describeResult.outputParameters = new
13 List<Process.PluginDescribeResult.OutputParameter>{
14 new Process.PluginDescribeResult.OutputParameter('testOutputParam',
15 Process.PluginDescribeResult.ParameterType.STRING)
16 };
17
18 return describeResult;
19 }
20
21 // Example Plugin that demonstrates how to leverage the reconOffset/nextReconOffset/reconState
22 // parameters to create more than 10,000 users. (i.e. go beyond the 10,000 DML limit per transaction)
23
24 global override Process.PluginResult invoke(Process.PluginRequest request) {
25 Map<String,String> result = new Map<String,String>();
26 String uprId = (String) request.inputParameters.get('userProvisioningRequestId');
27 UserProvisioning.UserProvisioningLog.log(uprId, 'Inserting Log from test Apex connector');
28 UserProvisioningRequest upr = [SELECT id, operation, connectedAppId, state
29 FROM userprovisioningrequest WHERE id = :uprId];
30 if (upr.operation.equals('Reconcile')) {
31 String reconOffsetStr = (String) request.inputParameters.get('reconOffset');
32 Integer reconOffset = 0;
33 if (reconOffsetStr != null) {
34 reconOffset = Integer.valueOf(reconOffsetStr);
35 }
36
37 if (reconOffset > 44999) {
38 result.put('reconState', 'Completed');
39 }
40
41 Integer i = 0;
42 List<UserProvAccountStaging> upasList = new List<UserProvAccountStaging>();
43 for (i = 0; i < 5000; i++) {
44 UserProvAccountStaging upas = new UserProvAccountStaging();
45 upas.Name = i + reconOffset + '';
46 upas.ExternalFirstName = upas.Name;
47 upas.ExternalEmail = 'externaluser@externalsystem.com';
48 upas.LinkState = 'Orphaned';
49 upas.Status = 'Active';
50 upas.connectedAppId = upr.connectedAppId;
51 upasList.add(upas);
52 }
53 insert upasList;
54 result.put('nextReconOffset', reconOffset + 5000 + '');
55 }
56
57 return new Process.PluginResult(result);
58 }
59}UserProvisioningPlugin のメソッド
UserProvisioningPlugin のメソッドは次のとおりです。
invoke(request)
署名
public Process.PluginResult invoke(Process.PluginRequest request)
パラメータ
- request
- 型: Process.PluginRequest