Newer Version Available

This content describes an older version of this product. View Latest

Using the Process.PluginRequest Class

The Process.PluginRequest class passes input parameters from the class that implements the interface to the flow.

This class has no methods.

Constructor signature:
1Process.PluginRequest (Map<String,Object>)

The following is an example of instantiating the Process.PluginRequest class with one input parameter:

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);

Code Example

In this example, the code returns the subject of a Chatter post from a flow and posts it to the current user's feed.
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}