Process.PluginRequest クラスの使用
Process.PluginRequest クラスは、インターフェースを実装するクラスからフローに入力パラメータを渡します。
このクラスにはメソッドはありません。
コンストラクタの署名:
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 = 'Force.com 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}