この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

Process.PluginRequest クラスの使用

Process.PluginRequest クラスは、インターフェースを実装するクラスからフローに入力パラメータを渡します。

Process.Plugin インターフェースではなく @InvocableMethod アノテーションを使用することをお勧めします。

  • インターフェースは、Blob、Collection、sObject、および Time データ型と一括操作をサポートしていません。インターフェースをクラスに実装すると、クラスはフローからしか参照できません。
  • アノテーションは、すべてのデータ型と一括操作をサポートしています。アノテーションをクラスに実装すると、クラスはフロー、プロセス、および Custom Invocable Actions REST API エンドポイントから参照できます。

ヒント

このクラスにはメソッドはありません。

コンストラクタの署名:
1Process.PluginRequest (Map<String,Object>)

次に、Process.PluginRequest クラスを 1 つの入力パラメータでインスタンス化する例を示します。

1Map<String,Object> inputParams = new Map<String,Object>();
2        string feedSubject = 'Flow is alive';
3        InputParams.put('subject', feedSubject);
4        Process.PluginRequest request = new Process.PluginRequest(inputParams);

コード例

この例では、コードはフローからの Chatter 投稿の件名を返し、現在のユーザのフィ��ドに投稿します。
1global Process.PluginResult invoke(Process.PluginRequest request) { 
2        // Get the subject of the Chatter post from the flow
3        String subject = (String) request.inputParameters.get('subject');
4        
5        // Use the Chatter APIs to post it to the current user's feed
6        FeedPost fpost = new FeedPost(); 
7        fpost.ParentId = UserInfo.getUserId(); 
8        fpost.Body = 'Flow Update: ' + subject; 
9        insert fpost; 
10
11        // return to Flow
12        Map<String,Object> result = new Map<String,Object>(); 
13        return new Process.PluginResult(result); 
14    } 
15
16    // describes the interface 
17    global Process.PluginDescribeResult describe() { 
18        Process.PluginDescribeResult result = new Process.PluginDescribeResult(); 
19        result.inputParameters = new List<Process.PluginDescribeResult.InputParameter>{ 
20            new Process.PluginDescribeResult.InputParameter('subject', 
21            Process.PluginDescribeResult.ParameterType.STRING, true) 
22            }; 
23        result.outputParameters = new List<Process.PluginDescribeResult.OutputParameter>{ }; 
24        return result; 
25    }
26}