{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":3969,"path":"build-workflows/workflow-studio/build-flow-from-template.md","title":"Build a flow from a template in App Engine Studio","bundle":null,"doc_type":null,"release":"australia","body":"\n# Build a flow from a template in App Engine Studio\n\nStep through an example of how to build, test, and activate a flow using a flow template in App Engine Studio.\n\n## Before you begin\n\nCreate an application in App Engine Studio. Once your application is built, you can use flow templates to create flows. For more information, see [Building applications in App Engine Studio](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/application-development/aes-app-creation.md).\n\nRole required: admin, flow\\_designer, or delegated\\_developer\n\n## About this task\n\nTo help you get started with building a flow from a flow template, follow along with the steps below. The example flow will start, or trigger, every time a user on the instance creates a request for a Service Catalog item. When a request is created, our flow will automatically run the following actions:\n\n-   Check if the catalog item's price is greater than $1,000.\n-   If the price is greater than $1,000, notify the requester's manager to approve the request.\n-   Otherwise, if the price is less than or equal to $1,000, automatically approve and close the request.\n\n## Procedure\n\n1.  Navigate to **All** &gt; **App Engine Studio** &gt; **App Engine Studio**.\n\n2.  From the My Apps page, open your application.\n\n3.  In your application, next to Automation, click the add icon \\(\\[Omitted image \"plus-icon-gray-small.png\"\\] Alt text: Add icon\\).\n\n4.  From the gallery of automation templates, select **Create an approval for a requested catalog item**, then click **Begin**.\n\n5.  From the **Template catalog item** list, select the **Standard Laptop**.\n\n6.  In the **Ask for approval if the catalog item's price is greater than** field, enter `1000`, then click **Done**.\n\n7.  In the **Name** field, enter `Approval flow for requested items`.\n\n8.  In the **Description** field, enter `Approval flow for requested items`, then click **Continue**.\n\n9.  Once your flow is created, click **Edit this flow**.\n\n10. On the flow page, click the **If not approved** step, then click **Delete** to remove the step.\n\n11. At the bottom of the flow, click the **Log** step, then click **Delete** to remove the step.\n\n12. In the same way, delete the last two log actions at the bottom of the flow.\n\n13. Select **Add an Action, Flow Logic, or Subflow**.\n\n    Then, select **Flow Logic** and choose **Else** from the flow logic picker.\n\n14. Under your **Else** flow logic, select the plus icon \\(\\[Omitted image \"add-action-icon.png\"\\] Alt text: Plus icon.\\) and then select **Action**.\n\n    From the action picker, select the **Update Record** action.\n\n15. Add the following values for the Update Record action's inputs:\n\n    |Input|Action|\n    |-----|------|\n    |Record|Click the pill picker icon \\(\\[Omitted image \"data\\_pill\\_picker.png\"\\] Alt text: Pill picker icon.\\) to open the dot-walker. Then, navigate, or dot-walk, to **Trigger - Service Catalog** &gt; **Requested Item Record** and select **Requested Item Record** to add this data pill to the input.|\n    |Table|Leave as `Requested Item [sc_req_item]`.|\n    |Fields|Select **+ Add field value**. Then, select the **Approval** field and choose **Approved** as the field's value. Next, select the **State** field and choose **Closed Complete** as the field's value. Finally, select the **Close notes** field and enter `Request automatically approved, as requested item's value is less than $1,000` for the field's value.|\n\n    Now, you've successfully set up a conditional action that automatically approves and closes the catalog item request if the requested item's price is less than or equal to $1,000.\n\n16. To finish adding the conditional **Update Record** action within the **Else** flow logic of your flow, click **Done**.\n\n17. In the main header, click **Save** to save the changes you've made to your flow.\n\n    Your flow should look similar to the following example:\n\n    \\[Omitted image \"build-flow-from-template-example.png\"\\] Alt text: An example approval flow requiring manager approval for requested items whose price is greater than $1,000\n\n18. To test your flow and see if it triggers and runs properly without any errors, go to the main header and click **Test**.\n\n19. In the Test Flow window, select a Requested Item record that has a price greater than $1000, then select **Run Test**.\n\n    For example, select the requested item record that you previously created from the service catalog \\(RITM0010001\\).\n\n    You can select the Create new record icon \\(\\[Omitted image \"add-record-button.png\"\\] Alt text: Create new record icon.\\) to create a new requested item.\n\n20. Select **Your test has finished running. View the flow execution details.**\n\n21. On the Execution Details page, see the values that populated for the trigger and each automated action in your flow.\n\n    For more information, see [Flow execution details](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/build-workflows/workflow-studio/flow-execution-details.md).\n\n22. Navigate back to your flow.\n\n23. In the main header, click **Activate** so that your flow's trigger fires whenever a user on your instance creates a new Service Catalog Item Request record.\n\n\n## What to do next\n\nYour flow is now active and will run whenever it's triggered. Next, you can manage your flow every time it runs by viewing your flow's execution history. To view this history, click **Executions** in the main header. The resulting page shows you the state of completion for each flow execution as well as how long it took for each flow execution to run, or its runtime. To troubleshoot a flow execution for errors, select an execution from this list to open the [Flow execution details](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/build-workflows/workflow-studio/flow-execution-details.md).\n\n"}}