How to trigger a SharePoint 2010 workflow from a SharePoint 2013 workflow

How to trigger a SharePoint 2010 workflow from a SharePoint 2013 workflow

Rate This
  • Comments 2

 

Hello guys,

I’m Chong Youn (John) Choe, a PM in SharePoint Designer team. SharePoint and SharePoint Designer 2013 beta 2 is now on public, making us Product Group members delighted to share supplementary postings with you.

This posting will describe why calling the legacy style workflow is enabled and how to use it.

Background

First of all, this feature is expected to greatly enhance the reusability of SPD workflows. Users will be able to set up highly reusable workflows on SharePoint sites and take advantage of the workflows just like scripts or functions.

It was not possible for the capabilities of SharePoint 2013 workflows to fully replace all the functionalities of SharePoint 2010 actions due to the fact that SharePoint 2013 is based on a different platform and has been rebuilt upon it. The workflow product teams invested on making new features to enable richer new end-user scenarios and gave up less frequently used features based on user feedbacks.

Nevertheless, the workflow product teams strongly wanted to cover all the existing scenarios. Consequently the “Start a Workflow” actions were designed to let the end users combine SharePoint 2013 and SharePoint 2010 by enabling inter-workflow calling from 2013 workflow to 2010 workflow. It was the only economic solution to provide a migration path for current SPD users.

Workflows can be categorized into 3 types; List workflow, Reusable workflow, and Site workflow. For details please refer to the blog posting. Reusable workflow takes in input parameters at the association time, and can be triggered on a list and an item in the list as if it were a List workflow afterwards. To start a workflow, SharePoint 2010 workflow should be ready for run at the moment it is called, which means that it needs to be already associated if it is a Reusable workflow. Hence, these are supported by a single action “Start a List Workflow” which receives 3 parameters; the SharePoint 2010 associated workflow to be triggered, initiation form parameters, and target item the associated workflow will run on. On the contrary, Site workflow does not need an item to run on so rely on another action “Start a Site Workflow” which receives 2 parameters; the SharePoint 2010 site workflow to be triggered, and initiation form parameters.

Last but not least, in case you want to know what are underneath the surface, “workflow interop bridge” can be found here http://msdn.microsoft.com/en-us/library/sharepoint/jj163181(office.15).

 

Example Scenario

Now that you understand the concept, let’s talk about how and when to use these actions. An example scenario and a step-by-step description is going to be presented. J

Assume there has been a “Budget Approval” workflow being used in SharePoint 2010 site. An IT admin had decided to upgrade the SharePoint 2010 to SharePoint 2013, the existing SharePoint 2010 workflows have been migrated to the new site subsequently (note: this does not mean the workflows were upgraded to SharePoint 2013 workflows. These workflows are still SharePoint 2010 workflows). The “Budget Approval” workflow is used for requesting budget from the finance or HR department, and takes 4 parameters as input; “Budget requested” for the requested amount of money, “Explanation” to describe why it is needed, “Requested approval due date” for the response due date, and “Reference” to point any related information.

Let say you want to use the “Budget Approval” workflow as a part of a new workflow process, in the past you would have to create a new workflow and rewrite the workflow in the new framework. And if you want to combine 2013 workflow’s newly introduced features along with the “Budget Approval” workflow it might have been impossible to write it all into one workflow.

The “Start a Workflow” actions are a perfect solution in such a case. Let’s assume the “Budget Approval” workflow is a List Workflow under “Contoso finance” list where Contoso’s financial processes are automated by workflows.

 

Design Steps

 

1. Insert “Start a List Workflow” action when the target workflow to be triggered is a List Workflow or a Reusable Workflow associated to a list.

clip_image001

 

2. With the action inserted, the workflow or association needs to be selected first, do this by clicking on the “SharePoint 2010 list workflow” link.

clip_image002

 

3. Find the list the target workflow resides in, and choose the workflow in turn.

image

 

4. Click “OK” to close above dialog. Next, click on the “parameters” link found in the Start a List workflow action sentence. SharePoint Designer 2013 will then analyze the workflow and display initiation parameters and their predefined values.

image

The dialog will display additional “Type” information for each of the different parameters. That’s because the author of the SharePoint 2013 workflow may be different from that of the SharePoint 2010 workflow and we wanted to provide enough information for the author of the SharePoint 2013 workflow to set the initiation form parameter values without looking into the called workflow.

 

5. You can set each parameter’s value during design time, lookup values are allowed to be chosen here and the value will be actually set during run time. This makes it flexible enough to design an integrated process using a SharePoint 2013 workflow calling and a SharePoint 2010 workflow called.
Restrictions are also given on the dialog, so you do not need to learn the parameter’s information beforehand.

image

 

6. Of course you can also set the value by typing it directly in the text editor. Note that dialog and its functionalities differ by the parameter types.

image

image

 

7. When you press “…”, a corresponding designer type for the type of parameter being populated pops up and guides your input. While standard lookup dialog is displayed when “Fx” button is clicked.

image

image

 

8. Once the parameters are all set, close the “Set Values for Initiation Parameters” dialog. The number of parameters set will be displayed directly on the action sentence.

image

image

 

9. Next, choose the item that the target workflow will run on. Usually you will want to run the process on “the current item”, which means that the calling workflow and called workflow to be executed and leave logs and results on the same item. To support the general scenario you should choose “Current Item” for “this item” parameter.

image

 

And you’re done! Calling a SharePoint 2010 workflow is as simple as adding an action sentence and setting appropriate values. J Actually the process resembles the behavior of end users triggering the SharePoint 2010 workflow on the SharePoint server. Choosing a list, an item and an associated workflow, and filling out the initiation form. The end user steps on the SharePoint server are below.

clip_image021

image

image

 

Another great feature is that you can use the value of called workflow’s variables inside the SharePoint 2013 workflow calling. These variables will be made available in the SharePoint 2013 workflow through the use of the lookup dialog.

I will explain this further with an example scenario.

A new company policy is declared, the workflow designer needs to send a notification email to the participants of the budget approval process to review the new policy.

 

10. Add “Send an email” action to send emails to the participants of the budget approval.

image

 

11. To lookup the SharePoint 2010 workflow’s variables, choose “Workflow Lookup for a User” for the “To” control.

image

 

12. A new data source is automatically made after inserting the “Start a List/Site Workflow” action and choosing the SharePoint 2010 workflow. The name of the data source consists of a static text “SharePoint 2010 Output” and the workflow’s name.

image

 

13. Every variable of the “Budget Approval” will be displayed in the 2nd dropdown: “Field from source”. Choose the required variable and press the “OK” button to set the “to” value in the email dialog.

image

 

14. Fill in the “CC” section likewise. Note that the variables are manually created by the person who created the SharePoint 2010 workflow. Fill in the rest of the fields with whatever values you wish.

image

image

 

I hope that you can now understand how to use the return values from SharePoint 2010 workflow well.

The previous example showed how you can use the “Start a Workflow” actions to call into a legacy workflow. You can extend upon this concept though, and use the same action to add additional functionalities into the SharePoint 2013 workflows. For example, there are some actions which are only available in the SharePoint 2010 workflows (i.e. the lookup manager action), you could use the “Start a Workflow” actions to trigger another workflow that use these legacy actions and expand the capabilities.

Once you master the “Start a Workflow” actions and its usage. SharePoint 2013 workflow and SharePoint 2010 workflow will no longer feel like separate workflow forms. J

Limitations

There are limitations in fully combining the strengths of SharePoint 2013 and 2010 workflows.

Some are due to design changes in the new platform. For instance “Assignment Stages” type parameters are not supported in “Start a Workflow” since the parameter type is no longer supported in SharePoint 2013 workflows. In other words, you need to use SharePoint 2010 workflow by itself if you must use “Start Approval Process”.

In addition, any workflow you want to link to using the “Start a Workflow” action should reside in one site. However, all of the different workflows will have their workflow status pages displayed on separate pages.

And finally, calling workflows associated to a different list cannot run on the current item of the SharePoint 2013 workflow. This is expected since the two workflows would be running against different lists. As such, if running a workflow on a different list, you will need to choose a specific item in the target workflow’s list to run the workflow against.

Summary

A “Start a Workflow” action triggers a SharePoint 2010 workflow in the middle of a SharePoint 2013 workflow’s execution at the run time. It has two types of action depending on the called workflow’s type, “Start a List Workflow” and “Start a Site Workflow”.

Choose the target workflow and set the initiation parameters of the workflow with fixed values or dynamic values. Also choose the list where the workflow belongs and the item the workflow will run on in case of “Start a List Workflow”.

You’ll be able to put this action anywhere in a SharePoint 2013 workflow, even calling multiple SharePoint 2010 workflows is allowed. You can reuse existing SharePoint 2010 workflows without re writing the actions in it. It is a very efficient and handy method to blend SharePoint 2013 and SharePoint 2010 workflows.

In addition, the return values from the SharePoint 2010 workflows called are made available to the calling SharePoint 2013 workflow’s logic via the lookup dialog. Return values include all the local variables and a few more conditional variables as well for any SharePoint 2010 workflow called in the same SharePoint 2013 workflow.

I hope you enjoy the benefits this brings!

Chong Youn (John) Choe

  • what new enhancement microsoft has given in 2013 compared to 2010 seems to be really good i guess micrsoft should provide seamless integration and less confuguration with ASP.NET, to ensure stability.................

  • Well demonstrated

Page 1 of 1 (2 items)
Leave a Comment
  • Please add 4 and 4 and type the answer here:
  • Post