Lightning コンポーネントを使用したフローアクションの作成
フローでクライアント側のロジックを実行するには、カスタム Lightning コンポーネントをフローアクションとして使用します。たとえば、Salesforce サーバを経由したり、別のブラウザタブで URL を開いたりせずに、サードパーティシステムからデータを取得します。コンポーネントマークアップ、クライアント側コントローラ、デザインリソースを、Cloud Flow Designer と互換性があるように設定します。次にフローで、コンポーネントを参照するローカルアクション要素を追加します。
例
Hello, World と表示される JavaScript アラートをトリガする、サンプルの「Hello World」コンポーネントとクライアント側コントローラを次に示します。Cloud Flow Designer では、フローアクションコンポーネントがローカルアクション要素として表示されます。
1<aura:component implements="lightning:availableForFlowActions" access="global">
2 <aura:attribute name="greeting" type="String" default="Hello" access="global" />
3 <aura:attribute name="subject" type="String" default="World" access="global" />
4</aura:component>1({
2 // When a flow executes this component, it calls the invoke method
3 invoke : function(component, event, helper) {
4 alert(component.get("v.greeting") + ", " + component.get("v.subject"));
5 }
6})