SharePoint 2013 workflows do not have a default action to start another 2013 workflow. There is an action to start 2010 workflows, but for my solution I required the more advanced actions only available with SharePoint 2013 workflows. With the help of the call http web service action I was able to create a REST call that started the workflow. The solution was build on SharePoint Online (Office 365) using a SharePoint 2013 workflow.
The REST call workflow consist of three major parts;
- The HTTP web service URL
- The SubscriptionID of the workflow that needs to be started
- The itemID of the item on which the workflows needs to be started.
A side note: The workflow that is being started needs to be configured to start manually. I could not find any reference on MSDN about this, but without this option I would get an error message.
Solution
- Create a SharePoint 2013 workflow
- Create a string variable called CurrentItemID
- Create a string variable called WorkflowGUID
- Create a string variable called regURL
- Now we need to find the SubscriptionID of the workflow we want to start. It is possible to use another REST call to find the SubscriptionID. But I prefer the following method.
- Navigate to the workflow settings of the list where the workflow is located
- Right-click on the workflow and open the properties
- Copy the URL and find the SubscriptionID within the URL
- Set the variable WorkflowGUID with the found SubscriptionID
- Set the variable CurrentID with the ItemID of the current item or item on which the workflow needs to start.
- Then store the following URL to the variable regURL
[%workflow Context: Current Site URL%]_api/SP.WorkflowServices.WorkflowInstanceService.Current/StartWorkflowOnListItemBySubscriptionId(subscriptionId='[%Variable: WorkflowGUID%]',itemID='[%Variable: CurrentItemID%]')
- Add the Call HTTP web service to the workflow and set the “this” to the regURL
- Set the HTTP Method to HTTP POST
- The workflow will now look like this
- The app step is used to make sure the workflow has the required permissions. More details about the App Stepp will be explained in another blog post.
I agree with your point, please share with us more good articles..
Will this app step work flow starts another work flow automatically?
Cool and easy !! exactly the solution i was looking for
Very good and Knowledgeable information
I would like to thank you for the efforts
you have made in writing this interesting and
knowledgeable article.
There is more relative topics below :
Independence Day
This is fabulous and worked like a charm – I’m using SharePoint 2016…