Create And Publish Reusable Designer Workflows To SharePoint Online

Workflow is a handy tool when we have to automate business processes or implement logic in response to some events within SharePoint. To accomplish this out of the box, we have SharePoint Designer that helps us to create and publish Workflows to SharePoint. Generally, there are three types of Workflows which are given below.

  • List Workflows
  • Reusable Workflow
  • Site Workflow

List Workflow is attached to a particular list and the logic will be executed upon that specific list. Thus, if we want to have the same Workflow logic be attached to another list, we will have to recreate the Workflow for the new list. To overcome this issue, we have the reusable Workflow, where we can attach the Workflow to a content type. Hence, any lists that inherit the content type will have the Workflow also attached to it. In this way, we don’t have to recreate similar Workflows for multiple lists. Another type of Workflow is the Site Workflow that is attached to the specific site. Unlike List and Reusable workflows, Site workflows does not get triggered in response to added/modified events. We have to manually trigger the site Workflows.

We saw how to create the List workflow in the previous article. In this article we will see how to create a Reusable Workflow in SharePoint Online.

What are we going to do?

We will create two lists namely ‘Employee Records’ and ‘Department Records’. We will then create a Site Content Type named EmployeeCT which will be inherited by the Employee Records List. Finally a reusable workflow will be created and attached to the EmployeeCT content Type by which the workflow will become available to the Employee Records List. The workflow does nothing but the copying of the List Item from Employee Records List to Department Records List.


Create Site Columns and Content Type

Since Reusable workflows are dependent on the Content Type, let’s create the site columns and then add it to the content type first. I have already created the site columns under the Employee Group.


Now let’s create a site content type and then we will add the above site columns to it.


Once the Content Type is in place, select Add from existing site columns to add them to the Content Type.


Select all the columns from the Employee Custom Group.


The site columns has come under the EmployeeCT content type now.


Create Master and Child Lists

Create the master list Employee Records and inherit EmployeeCT content type which we had created earlier. Set it as the default content type.




Create the Child List ‘Department Records’ that will have the same site columns as in the master list, Employee Records




Connect to SharePoint Online

Since the prerequisites required for the creation of the workflow are in place, let’s spin up SharePoint Designer.


Click on Open Site to connect to the SharePoint Online Site.


Specify the SharePoint Online Site in the Site name field and click on Open.


This will open up the Sign in page where we have to enter the email id of the user whose credentials will be used to connect to SharePoint Online.


Specify the password and click on Sign in.


Thus, we are connected to SharePoint Online Site from Designer.


Create Reusable Workflow

From the top ribbon select Reusable workflow option so that we can get started with the designing of the workflow from the workflow designer.


This will open up the window where we can specify the Workflow Name, Description and the Platform Type.


If we chose SharePoint 2013 Workflow we will get the below error saying we cannot associate the Workflow with a Content Type.

Since we want to create a reusable workflow by binding it to a content type lets go ahead with SharePoint 2010 Workflow and Bind it to the EmployeeCT content type.


I have added the step to copy the list item from Employee Records to the Department Records List.


Once we are done designing the workflow and adding the workflow conditions we can go to the ribbon and select Associate to Content Type option and select EmployeeCT as the destination content type.


Finally Publish the workflow.


Check the Workflow

If we head over to the EmployeeCT Site Content Type , we can see that the new workflow has been added to the Site Content Type.


Test the Workflow

Now, it’s time to test the workflow we have created. Let’s go ahead and create a new list item in Employee Records List.


This will trigger the workflow and we can see the workflow status column shows ‘Completed’ Status.


If we go to the advanced option of the item and select Workflows we can see the detailed workflow details like status and runtime.




Let’s go to the Department Records list and see if the item has been copied over here.


The Department Records list has a copy of the list item which was created by the workflow.

Summary

Thus, we saw how to create and publish a reusable workflow to SharePoint Online.