How to Create a SharePoint Designer 2013 Workflow with App Step (extension from the example workflow used for SPC 2012)
Hi, I’m JongHwa Lim, a Program Manager at SharePoint Designer team.
Today, I will show you a sample workflow which was demoed at SharePoint Conference 2012 (aka. SPC 2012). In addition to it, I will modify and extend it to make it more realistic in this blog post. This blog article contains some tips you can use when creating a workflow with SharePoint Designer 2013 (aka. SPD 2013). In explaining the detail, I will assume that you are familiar with the SharePoint Designer 2013 and SharePoint 2013 type workflow. If you are not, please read the previous blog articles to learn about SharePoint 2013 workflows.
A workflow for a leisure event company
Let’s assume there is a leisure company named Contoso Leisure and it provides leisure lessons such as horseback riding, fishing, clay shooting, paragliding, and skydiving.
And let’s assume we need an approval workflow which does the following.
- Request approval from the Event Coordinator SharePoint Group
- If rejected, send rejection mail to the customer
- If approved, wait until 5 days before the event/lesson and then send reminder mail for the event
- Reminder mail contains information on the event such as weather information and a map with driving direction
In this workflow example, we will use two web services but only one web service will be handled by ‘call HTTP Web Service’ action available in SPD. The other web service will be referenced inside of a String variable and put into the mail body with an <IMG> tag. For more information, you can reference the Bing Map API page. (https://www.microsoft.com/maps/developers/web.aspx)
If you create the workflow yourself, the following workflow will be created.
Please notice that the ‘Get Weather Info’ stage has a ‘Call HTTP Web Service’ action and if you click the first parameter, you will see the following URL is used, where the web service key is stored in a separate list named ‘Web Service Keys’. I will defer the explanation and usage of the Web Service action, Get Item from Dictionary action and Loop container to a previous blog post by HyongGuk Kim.(https://blogs.msdn.com/b/sharepointdesigner/archive/2012/09/05/how-to-work-with-web-service-using-call-http-web-service-action.aspx)
And if you click the ‘Set Workflow Variable’ action in the ‘Send Reminder Email’ stage, you will find it also uses the ‘Web Service Keys’ list to store the web service key or token.
Let’s make this more realistic
In a real life situation, the web service keys may need to be managed securely. To do that, we need to secure them by storing them in a list which is accessible only by people with Full Control privilege. But in this case, the normal workflow logic would fail to access the web service keys as it is run under the permission of workflow initiator and (logical AND) that of Workflow App. So if the workflow initiator does not have permission to access the list that contains the web service keys, the workflow will fail. To make the workflow logic run under only the Workflow App permission which is Read/Write to all site lists, we need to use an App Step.
Step 1. Make the list secure by having independent permission
As explained, we need to make the list containing the web service keys accessible only by Full Control users. To do that, you need to stop inheritance and remove unnecessary users from the list.
Let’s say the list is ‘Web Service Keys’ list. If you go to the List Settings and Permission for this list page, you can find the menu to stop inheritance.
After breaking inheritance, you can choose non-Full Control users as below and click Remove User Permissions button.
Then, the list will only have Full Control users.
Step 2. Activate the App Step feature
To use App Steps, you need to activate the Workflows can use app permissions site feature in Site settings->Manage site features as below.
Then, the App Step button in SPD will be enabled.
Step 3. Add App Step and move the logic into it
You need to find the pieces of logics which reference the ‘Web Service Keys’ list and then enclose them inside an App Step container. We have two pieces of logics we need to place inside of an App Step – Call HTTP web service action and Set RouteMap variable action, which is illustrated in the figures below:
Step 4. Publish your workflow
When you publish your workflow, the following dialog will show up to explain the behavior.
I hope you enjoyed this article and you learned about how to use App Steps appropriately. See you in the next article.
Comments
- Anonymous
December 11, 2012
Hi, good post. and thanks for the sharing. I am building a small project in Office 365 preview of 2013. I created a SharePoint-hoste app with a simple SPList. And I want to create a workflow with Designer and bind it to this list. But the problem is, as the SharePoint-hosted app will be create in a sub-site of the current site, which cannot be connected by designer. How could I create the workflow with Designer? or I have to use Visual Studio for such workflow development? Thanks!
- Renger
Anonymous
December 13, 2012
App Web is blocked in SPD 2013, which is by design from the request of the owner team of App Web. Visual Studio is the right way to follow.Anonymous
March 16, 2013
Actually people has been asking for end-end processes could be design in spd 2013 , I have been using spd2010 actually end-end is a issue because there is huge business logic involve......but I am hoping spd2013 has come up with the right tool this time Thanks, Sarah browse for sharepoint www.sqlservermanagementstudio.netAnonymous
May 27, 2013
is there any workflow migration guideline from MirosoftAnonymous
January 21, 2014
How come this blog has not had any new content added in over 1 year. Has the SPD team been disbanded?Anonymous
October 17, 2015
Expecting some more on SPD Team ! There's a lot of people in need for guidance like this for no code solutions