Below is some sample code to provision a workflow on the host web from your app web. This sample code is in one block for demo purposes. It makes 4 asynchronous calls to SharePoint to complete successfully.
In the event you’d want to define in your App a workflow that would run on a list in the host web this is the code you would use to deploy (move it from App to Host) and attach it to a list in the host web.
NOTE: you must include a reference to “/_layouts/15/SP.WorkflowServices.js”
Nice Article, Thanks for sharing.
I want to know is it possible to deploy custom workflow activities from App web to hostweb?
Did you ever figure this out? It seems that if your workflows contain custom activities, you get an error trying to deploy the workflows from app web to host web. Do you know if there is a way of programmatically deploy the actvities to host web?
Great Job Thomas..
Perfect Code.. Thanks for sharing..
I trying your code and it’s creating the workflow and association but not carrying over the initiation form. Is there something that needs to be set on the subscription object or elsewhere to set the workflow to first call the init form?
How to implement this to SharePoint-Host Apps? Event Handler is not support to SharePoint-Hosted Apps.
This article is based on SharePoint hosted apps. To provision to the SharePoint site you would need to implement a configuration screen in your app.
Can I use above code to associate workflow from app web to host web on ONPREMISES SharePoint 2013. Seems everyone are talking about associating on SharePoint online only. Is there a way to associate a app workflow to already created host web in SharePoint ONPREMISES.
Good job, this is awesome piece of code! Very useful, thanks for sharing.