In this article, I would like to share the steps to add the SharePoint hosted app workflow to the host web list.

In our previous  article, we have seen how to create an app workflow in SharePoint hosted apps. Here, we will discuss how to add the SharePoint hosted app workflow to the host web list.

Steps to add workflow

Follow the below steps for adding the workflow in the host web list.

Step 1

Package the SharePoint app from Visual Studio.

Package the SharePoint app

Step 2


After publishing the app, right click on the .app file and select 7-zip to open the archive, as shown below.


Note: Download the tool here.

 7-zip

Step 3


Once it's opened, select the WorkflowManifeas.xml file and open it in notepad.

WorkflowManifeas

Step 4


Then, copy the below code, paste it to the workflow manifest file, and save it.
  1. <SPIntegratedWorkflow xmlns="http://schemas.microsoft.com/sharepoint/2014/app/integratedworkflow">  
  2.       <IntegratedApp>true</IntegratedApp>  
  3. </SPIntegratedWorkflow>  
code

Step 5


After clicking Save, you will get the following pop up. Just click OK.

pop up

Step 6


Then, upload the app package in your App Catalog.


upload the app package

Step 7


After uploading the file, install the app on your site.


install

Step 8


Go to your SharePoint site and open the list where you need to add the workflow.


add workflow

Step 9


Then, select the 
List tab from top ribbon.

List

Step 10


On the ribbon, click on the Workflow settings. Then, select the Add a workflow, as shown below.

add workflow

Step 11


Now, click on your app workflow. It will navigate to Add a workflow page.

Add work flow page

Step 12


Select the workflow template, as shown below, and then, provide the following details. 
  1. Name
  2. Select Task List
  3. Select History List
  4. Select start Options

    workflow
    workflow

Step 13


Click OK for adding the app workflow.

app workflow
 
Your workflow will be started successfully when items are added/Modified.

items

Summary


In this article, we have explored how to add the SharePoint hosted app workflow to the host web list in SharePoint Online.