Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
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>)Here’s 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 = '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}