Getting started with actions Transform the Ask for Approval action into a reusable action that always requires manager approval. Before you beginRole required: admin Note: While Action Designer is designed to use the action_designer and delegated_developer roles in most scenarios, this tutorial uses the admin role to illustrate functionality without requiring additional roles to set up records and approve requests. Complete the steps in Getting started with flows. This tutorial replaces the Ask for Approval action in the Expense Approval flow. About this task Actions are made up of: Inputs: Data variables used in your action. Steps: Operations on the inputs or results from a prior step that generate data that can be used in later steps. Outputs: Data variables that represent the results of the action. These results are available to other actions in a flow. Unlike the core Ask for Approval action where flow designers must manually configure the approval rules, this custom action always uses the same approval rules when added to a flow. You might create a reusable action if your flow designers often use an action with the same configuration. For example, if your flow designers always use the request manager approval and due date options, this action automatically uses them and therefore requires less flow configuration.Demonstrates creating actions within a flow in the Flow Designer, and testing a flow. Procedure Open the Expenses Getting Started application in Studio. Alternatively, you can navigate to Flow Designer > Designer and select New Action to access Action Designer in the platform. In the Action Properties, select your scoped application in the Application field. Create an action. Click Create Application File. Under Flow Designer, select Action and click Create. In the Name field, enter Ask for Manager Approval. In the Description field, enter Approve or reject a request based on manager approval or rejection. Allow manual approvers to be added. Click Submit. An Ask for Manager Approval action is created in the Expenses Getting Started scope. Define the inputs in the Ask for Manager Approval action. Select + Create Input and add the following values. Name: Request Type: Reference Reference Table: Expenses [x_expenses_getting_expenses] This input enables you to reference any field or record from the Expenses table. Use the data pills on the right-hand side to add the record or its fields to action steps. Add an Ask for Approval step. Click the + underneath Inputs in the Action Outline. Select Ask for Approval. Complete the fields in the Ask for Approval step. Record: Under the Input Variables category, drag the [Request] data pill from the right-hand pane. Table: Set to Expenses [x_expenses_getting_expenses]. Approval Field: Set to Approval. Journal Field: Set to Approval history. Define rules in the Ask for Approval step. You can use the data pill picker, or drag the data pills from the right-hand pane to select the data you need. [Approve] when [Anyone approves] from the field [action->Request->Requested for->Manager], [OR] [Anyone approves] from the field [Manual User(s)]. Select Add another OR rule set to define rejection rules: [Reject] when [Anyone rejects] from the field [action->Request->Requested for->Manager], [OR] [Anyone rejects] from the field [Manual User(s)]. Define a due date in the Ask for Approval step. [Approve] if pending by [Relative date] [Days] from [action->Request->Created]. Days schedule [8-5 weekdays excluding holidays]. This due date automatically approves all requests that have not been approved or denied within one day from when the request was created. Define the outputs in the Ask for Manager Approval action. Adding an output makes data available to a flow. For example, this action outputs the approval state of the record. Select + Create Outputs and add the following values. Name: Approval state Value: In the right-hand pane, expand the Ask for Approval step category and drag the [Approval State] data pill. Click Save. Add a custom icon for your application that displays in Flow Designer. All actions in the application scope use the custom icon. In Studio, navigate to File > Settings. The application settings open. In the Logo field, select Click to add.... Upload an icon to use with your reusable actions. Test the reusable action within your flow. Return to the Expense Approval flow. Remove the 2.1 Ask for Approval action from the flow. This action will be replaced by the reusable Ask for Manager Approval action. Set Show draft actions to true. Add the Ask for Manager Approval action to your flow. In the right-hand pane, expand the Trigger - Record Created category and drag the [Expenses Record] data pill into the Request [Expenses] field. Click Save. Test the flow using a record with an amount below the designated limit. From the flow, click Test. The Test flow modal appears. In the Record field, select a record you created in earlier steps that has value in the Amount field under the 100.00 limit. Verify that you have not already run tests using this record. Select Run Test. After the flow executes, click Flow has been executed. To view the flow, click here. The Execution Details open. Because the amount is less than 100.00, the first condition is met and the request is approved. The Else condition is not evaluated. Test a record with an amount over the designated limit. Verify that you have not already run a test on the test record. Because the amount is over the designated limit, the second condition is evaluated. Approve the request. Navigate to the test record and change the value of the State field in the Approvers related list to Approved. Navigate back to the flow execution details and refresh the browser. Because the request is approved, the flow completes. Navigate to the Ask for Manager Approval action and click Publish. Publishing an action enables you to activate any flow that uses it. Navigate to the flow and set Show draft actions to false. Click Activate. Activating a flow sets it to run every time the trigger conditions are met. ResultThe Expense Approval flow runs every time a record is created in the Expenses table. Now that the flow is activated and working as expected, you can publish it to the application repository and deploy it to other instances.