{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":1570,"path":"application-development/app-engine-studio/create-scratch-flow.md","title":"Add a flow from scratch","bundle":null,"doc_type":null,"release":"australia","body":"\n# Add a flow from scratch\n\nIf an existing automation template doesn't fit your application goal, define custom automation in App Engine Studio \\(AES\\) by building a new flow.\n\n## Before you begin\n\nRole required: sn\\_app\\_eng\\_studio.user or delegated\\_developer. For more information, see [Delegate developers using AES](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/app-engine-studio/aes-app-dev-workflow.md).\n\n## About this task\n\nIf a pre-built flow already exists, you can easily add its template to your app and then customize it. For more information, see [Add a pre-built flow using a template](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/app-engine-studio/use-flow-template.md).\n\n## Procedure\n\n1.  Navigate to **All** &gt; **App Engine** &gt; **App Engine Studio**.\n\n2.  From the My Apps page, open your application.\n\n3.  In your application, in the Logic and Automation section, select **Add**.\n\n4.  Select the card for **Flow**.\n\n5.  Select **Build from scratch**.\n\n    \\[Omitted image \"aes-automation-scratch-purple.png\"\\] Alt text: Select to build the flow from scratch\n\n6.  On the form, fill in the fields and then select **Continue**.\n\n<table id=\"table_qf3_nxp_b4b\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nName\n\n</td><td>\n\nName to identify your flow.\n\n</td></tr><tr><td>\n\nDescription\n\n</td><td>\n\nDescription of your flow.\n\n</td></tr><tr><td>\n\nProtection\n\n</td><td>\n\nAccess settings for the flow. You can select one of the following options:-   **-- None --**\n\nOption to enable other users to edit the flow.\n\n-   **Read-only**\n\nOption to enable other users to view the flow but not edit it.\n\n</td></tr><tr><td>\n\nRun as\n\n</td><td>\n\nSelection to specify if the flow runs as a system user or the user who initiates the session. If updates should come from the user who triggered the flow, select **User who initiates session**. For example, when you want incident record comments to come from the current user, or approval emails to originate from the approver.\n\n</td></tr><tr><td>\n\nRun with roles\n\n</td><td>\n\nRoles that the flow runs with. This option is available only when **Run as** is set to **User who initiates session**.\n\n To use a custom role for your flow, you must create one in **Security** first. For more information, see [Add application security](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/app-engine-studio/add-security.md).\n\n</td></tr></tbody>\n</table>7.  On the summary screen, select **Edit this flow** to open your flow.\n\n8.  Add a trigger to your flow.\n\n    1.  Under the TRIGGER section, select **Add a trigger**.\n\n    2.  From the Trigger list, select a trigger that will start running your flow.\n\n        For more information on trigger types, see [Workflow Studio flow trigger types](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/build-workflows/flow-triggers.md).\n\n        The system displays a set of fields depending on the type of trigger that you've selected.\n\n    3.  Set up your trigger by filling in the fields.\n\n        For a record-based trigger, for example, select a table and set field conditions that, when met, will start running your flow.\n\n    4.  Click **Done**.\n\n9.  To add actions, flows, subflows, or flow logic, select **Add an Action, Flow Logic, or Subflow**.\n\n    1.  Select an option.\n\n<table id=\"table_smq_3ys_tcb\"><thead><tr><th>\n\nOption\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nAction\n\n</td><td>\n\nSelect the desired action. Workflow Studio includes [Workflow Studio actions](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/build-workflows/flow-actions.md) that are available to flows and subflows. Alternatively, a user with the action\\_designer role can create additional actions to add to flows. The [Integration Hub](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/integrate-applications/integrationhub.md) and [Spokes](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/build-workflows/spokes.md) plugins install additional actions.\n\n To add draft actions from the More Actions menu, set **Show draft actions** to **true**.\n\n To view spokes that are available in the ServiceNow Store, set **Show store spokes** to **true** from the More Actions menu.\n\n**Note:** Under **Not Installed Spokes**, the system displays spokes that are available in the ServiceNow Store based on compatibility with the ServiceNow version and application dependency on Workflow Studio.\n\n</td></tr><tr><td>\n\nFlow Logic\n\n</td><td>\n\nSelect an option to specify conditional or repeated operations.\n\n</td></tr><tr><td>\n\nSubflow\n\n</td><td>\n\nSelect a published subflow and define the input values. In addition to adding a subflow as a flow action, you can enable the **Show triggered flows** option from the More Actions menu to select an activated flow and define the required inputs. Running a triggered flow ignores its trigger conditions and runs all actions.\n\n</td></tr></tbody>\n</table>        To change the order of an action in a flow, drag the handle on the left side of the action to the desired location.\n\n        The system displays a set of fields depending on the option that you selected.\n\n    2.  To configure the action, flow logic, or subflow, fill in the fields.\n\n    3.  Select **Done**.\n\n    4.  Repeat adding actions until complete.\n\n10. To specify how the app will handle errors, enable the **ERROR HANDLER** switch and fill in the fields.\n\n    For more information on configuring how errors are handled in flows, see [Flow error handler](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/build-workflows/flow-error-handler.md).\n\n11. Select **Save**.\n\n    The ServiceNow AI Platform saves a draft of the flow, trigger, and actions.\n\n\n## What to do next\n\nTest your flow until you're ready to activate it. For more information on testing and editing flows, see [Activate a flow](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/build-workflows/flow-activate.md).\n\n**Note:** Your application can trigger only activated flows.\n\n-   **[Modify a flow](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/app-engine-studio/edit-flow.md)**  \nTo update or change an existing flow for an app you built in App Engine Studio \\(AES\\), edit it.\n\n**Parent Topic:**[Add logic and automation](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/app-engine-studio/add-automation.md)\n\n"}}