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

Newer Version Available

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

Plugin インターフェース

組織と指定したフローの間でデータを渡すことができます。

名前空間

Process

Plugin メソッド

Plugin のインスタンスメソッドを次に示します。

describe()

このメソッドのコールを記述する Process.PluginDescribeResult オブジェクトを返します。

署名

public Process.PluginDescribeResult describe()

invoke(Process.PluginRequest)

インターフェースを実装するクラスがインスタンス化されるときにシステムが呼び出す主なメソッドです。

署名

public Process.PluginResult invoke(Process.PluginRequest request)

パラメータ

request
型: Process.PluginRequest

戻り値

型: Process.PluginResult

Plugin の実装例

1global class flowChat implements Process.Plugin { 
2
3// The main method to be implemented. The Flow calls this at runtime.
4global Process.PluginResult invoke(Process.PluginRequest request) { 
5        // Get the subject of the Chatter post from the flow
6        String subject = (String) request.inputParameters.get('subject');
7        
8        // Use the Chatter APIs to post it to the current user's feed
9        FeedItem fItem = new FeedItem(); 
10        fItem.ParentId = UserInfo.getUserId(); 
11        fItem.Body = 'Force.com flow Update: ' + subject; 
12        insert fItem; 
13
14        // return to Flow
15        Map<String,Object> result = new Map<String,Object>(); 
16        return new Process.PluginResult(result); 
17    } 
18
19    // Returns the describe information for the interface
20    global Process.PluginDescribeResult describe() { 
21        Process.PluginDescribeResult result = new Process.PluginDescribeResult(); 
22        result.Name = 'flowchatplugin';
23        result.Tag = 'chat';
24        result.inputParameters = new 
25           List<Process.PluginDescribeResult.InputParameter>{ 
26               new Process.PluginDescribeResult.InputParameter('subject', 
27               Process.PluginDescribeResult.ParameterType.STRING, true) 
28            }; 
29        result.outputParameters = new 
30           List<Process.PluginDescribeResult.OutputParameter>{ }; 
31        return result; 
32    }
33}

テストクラス

上記のクラスに使用するテストクラスは次のとおりです。

1@isTest
2private class flowChatTest {
3
4    static testmethod void flowChatTests() {
5      
6        flowChat plugin = new flowChat();
7        Map<String,Object> inputParams = new Map<String,Object>();
8
9        string feedSubject = 'Flow is alive';
10        InputParams.put('subject', feedSubject);
11
12        Process.PluginRequest request = new Process.PluginRequest(inputParams);           
13        
14        plugin.invoke(request);
15    } 
16}