Automating Email Notifications In Sharepoint With Workflows

What are SharePoint Workflows?

SharePoint workflows are automated processes that allow users to model business processes and workflows in SharePoint. Workflows define a sequence of actions that can be triggered automatically when an item in SharePoint is created or modified.

Out-of-the-box workflows provided by SharePoint include approval workflows for reviewing content, three-state workflows for managing project tasks, and disposition workflows for managing document retention. Custom workflows can also be developed in SharePoint Designer or Visual Studio using the SharePoint workflow platform.

Key Capabilities of SharePoint Workflows

  • Automate business processes and routines
  • Route documents for review and approval
  • Manage project tasks and assignments
  • Ensure consistency and compliance to business rules
  • Integrate with external systems via custom logic

Why Automate Notifications with Workflows?

Automating notifications through SharePoint workflows provides several key benefits:

Notifying Users of Changes and Events

Workflows can automatically send emails to alert users when certain conditions are met in SharePoint. This removes the need for users to manually track changes.

Increasing Process Visibility

Automated notifications provide visibility into business processes as they progress through various stages. Emails contain helpful context and history.

Reducing Response Times

Prompt notifications drive faster response times to items that require user action or input. Delays are minimized.

Use Cases for Automating Notifications

  • Content approval requests
  • Project milestone alerts
  • Document review reminders
  • Status updates to external stakeholders
  • Requests for input or action

Configuring a Notification Workflow

Setting up an automated notification workflow in SharePoint consists of several key steps:

Required SharePoint Components

  • SharePoint 2013 or SharePoint Online
  • Workflows feature enabled
  • Access to SharePoint Designer

Required Permissions

The user account configuring the workflow requires the following permissions:

  • Contribute access to the SharePoint site
  • Manage Lists and Libraries permissions
  • Appropriate workflow permissions

Tip: An account with Full Control or Design permissions will suffice in most cases.

Sample Workflow Design

As an example, we can create a workflow that emails a document author whenever that document is approved or rejected. The workflow would perform the following logic:

  1. Trigger when item in Document Library is changed
  2. Check if document status field equals Approved or Rejected
  3. If true, email document author notifying them of status change

Workflow Customization Settings

In SharePoint Designer, key configuration steps include:

  • Specify workflow start options
  • Map workflow parameters
  • Add workflow logic conditions
  • Configure email settings

Sending Automated Emails

Workflows can send rich, customizable email notifications by integrating with SharePoint’s incoming and outgoing email capabilities.

Connecting the Workflow

The workflow must connect to the SharePoint site’s email service application. This allows constructing and sending emails using SharePoint commands.

Defining Email Contents

Emails can contain dynamic content using workflow lookup steps to pull data from SharePoint list items and libraries. Useful email contents include:

  • Hyperlinks back to related items
  • Attachments like documents and reports
  • Item data fields like title, status, author

Specifying Recipients

Notification emails can route dynamically to various recipients using workflow logic. Recipients include:

  • Item creators or authors
  • Workflow assignees
  • Conditional recipients based on rules

Sample Email Notification Code

  // Fetch item data
  var linkUrl = workflowProperties.ItemUrl; 
  var itemTitle = workflowProperties.ItemTitle;
   
  // Construct email body   
  var body = "Please review the document at: " + linkUrl; 
   
  // Email parameters 
  var mailTo = workflowProperties.AssignedTo; 
  var subject = "Document Review Pending: " + itemTitle;
   
  // Send email
  Email(mailTo, subject, body);

Customizing and Extending Notification Workflows

SharePoint workflows for notifications can include additional logic like approvals, reminders, and escalations. Workflows can also integrate with external systems.

Incorporating Approvals

An approval process allows stakeholders to provide feedback on a document or item through email responses. Based on the collective feedback, the workflow can approve, reject, or re-route the item.

Adding Reminders

To prevent items from being forgotten, the workflow can check if certain actions have occurred by a deadline. If the deadline passes, the workflow can loop back and re-notify assignees.

Implementing Escalations

For critical items without responses, the workflow can escalate by sending notifications to the assignee’s manager or to secondary reviewers.

Workflow Development Options

For advanced customizations, options include:

  • SharePoint Designer for no-code workflows
  • Visual Studio for code-based workflows
  • 3rd party workflow add-ons

External System Integration

SharePoint workflows can call out to external platforms via web services and APIs to ingest or output data. This allows integration scenarios like:

  • Update CRM system with SharePoint list data
  • Create JIRA ticket for document review task
  • Pull data from SQL database into notification emails

Troubleshooting and Best Practices

Properly administering notification workflows can avoid common pitfalls and issues:

Checking Workflow History

Audit workflow execution history in SharePoint to diagnose problems. Failed runs will show detailed error messages.

Monitoring Performance

Check workflow processing time in the SharePoint Health Analyzer dashboard to ensure adequate throughput.

Configuring Retention Policies

Trim workflow history over time to reduce storage bloat. This ensures snappy operations.

Testing End-To-End

Rigorously test notification emails across all expected use cases before enabling workflows in production.

Securing Credentials

Use secure store service to encrypt and protect any credentials used to connect to external services.

Leave a Reply

Your email address will not be published. Required fields are marked *