A SharePoint Workflows tutorial by Peter Kalmström
In
many organizations it is suitable to have rental agreements
gathered in SharePoint lists. Small companies with few rentals
can use just one list for this, but if there are many rental
contracts to keep track of it is better to have them in
multiple lists and use a content type for consistency.
In the series
SharePoint Online from Scratch we show how to create
a content type for rental agreements. Here we will connect
two workflows to the content type also. This can no
longer be done in SharePoint Online, as SharePoint 2010
workflows no longer are supported there.
In the demo below Peter Kalmström, CEO and Systems Designer
of kalmstrom.com Business Solutions, shows how to create
a reusable workflow that sets the renewal date to two months
before the end date of the rental agreement.
Peter has to create a SharePoint 2010 workflow, because
SharePoint 2013 workflows cannot be connected to a specific
content type, which is necessary for this workflow.
Create a reusable workflow that sets renewal date
Open the root site of the site collection in SharePoint
Designer 2013.
Click on the Workflows link in the left panel.
Click on the Reusable Workflow button in the ribbon.
Create a new SharePoint 2010 workflow and give it
a name. Connect the workflow to the rental agreements
content type.
Select the Condition to 'If current item field equals
value' and set it to Renewal Date 'is less than' 1970
or some other value that is not going to happen. The
point here is that the field should be left empty by
users, which is less than 1970.
Select the Action 'Add Time to Date' and set the
Time to -2 months and the Date to End Date. Output to
a new variable.
Select the Action 'Update List Item' and set the
Field Renewal Date to the value of the new varialbe.
Do not set any start options. Here you can
only disable the workflow. Instead you will set the
start options when you associate the workflow with the
content type.
Publish the workflow
Now the workflow must be connected to the content type used
in the rental agreements lists. That is done once for the
whole site collection. Then all lists that use the rental
agreements content type will have the set renewal date workflow.
Associate the workflow with the content type
Open the Site settings in the root site of the site
collection and click on the Site content types link
in the Web Designer Galleries group.
Select the content type group that contains the
rental agreements content type and then the content
type itself.
Click on the Workflow settings link and then on
Add a workflow.
Select the reusable workflow you just created.
Give the workflow a name and set it to start when
an item is created or changed.
In the next two articles, we will build a workflow that
sends an e-mail alert to the responsible person on the renewal
date that was set in this workflow.