Follow the below listed steps, to add a workflow:
Step 1: Open your project in Visual Studio.
Step 2: Right click on your project and click on “Add”, as shown in the below picture.
Step 3: Then, click on “New Item” in the window, to select the “workflow” template.
Step 4: On pop up, select the workflow, as show in below image:
Step 5: Now, provide the name of the workflow as per your choice and click on Add button.
Step 6: Select the type of your workflow and then, click next, to proceed.
Step 7: Now, provide the list name, if you want to add your app to the web workflow. Otherwise, uncheck the check box, so that you can map the host web list and click Next.
Step 8: Then, select the option of how you want the workflow to start and finally, click on Finish, to create a workflow.
App workflow will be created successfully, as show in the below image:
Then, you can add the activity from the toolbox. Without any coding, we can achieve the workflow process in SharePoint online.
Summary
In this article, we have explored how to add a workflow in a SharePoint hosted app, using Visual Studio. I hope this article is useful to the SharePoint beginners.