Accelerating Workflow Process with Sitecore + Microsoft Teams Integration Module

It is highly important to equip Content Authors with required tools/integrations that will help them to accomplish tasks with minimal clicks possible. When it comes to involvement of more than one person (Content Author, Content Approver), there is a high possibility of delays in taking updates live that might be time-sensitive due to expected/unexpected communication delays. Automating this communication effectively through the business communication/collaboration platform along with quick actions(approve/reject), will not only avoid the delays but also help to optimize time & work. This modules allows seamless integration of Sitecore Workflow with Microsoft Teams (which is now replacing Skype).

The module can be downloaded from the below links,
Sitecore – Microsoft Teams Integration for SPE 6.x
Sitecore – Microsoft Teams Integration for SPE 5.x

NOTE:

  • This module is built on top of Sitecore Powershell Extensions (SPE), please make sure SPE is installed before installing this module
  • This module uses Sitecore Feed Urls, hence Approvals reside behind Sitecore Security and the links will prompt the Content Approver to authenticate before approving/rejecting the updates (if not logged in already)

STEPS TO CONFIGURE THE MODULE:

GIF by joelremygif (GIF Image)

Creating Microsoft Teams Channel:

  • Navigate to ‘Teams’ section of Microsoft Teams from left navigation bar and click on ‘Join or Create a Team’ Button
  • Select ‘Build a team from scratch’ (or) ‘Create from an existing team’ to create the team/channel
  • Provide Name (preferably ‘Workflow Moderators’) & Description for the Team and add required Content Authors & Approvers

Adding WebHook:

  • Once the team/channel is created, click on the ‘More Options’ (three dots) button available in the top right corner and click on ‘Connectors’
  • Search for ‘Incoming Webhook’ in the opening popup and click on ‘Add’ button
  • Add Name(preferably ‘Sitecore Workflow’) and Image, and click on ‘Create’ button
  • Copy the ‘WebHook URI’ which is appearing before closing the window
  • Navigate to \App_Config\Include\Sitecore+MicrosoftTeams.Integration.config file and paste the copied WebHook URI within value attribute of ‘Teams.WebhookURI’ setting,

Setting up Workflow Notifications:

  • Navigate to the Workflow for which the Notifications have to be setup
  • Right-Click Submit Action of Draft State, click on Insert -> PowerShell Action and Enter name as ‘Awaiting Approval Notification’
  • Select ‘Script Library/Sitecore + Microsoft Teams Integration/Workflow/Awaiting Approval Notification’ for ‘Script’ field in the newly created ‘Awaiting Approval Notification’ item
  • Similarly, add PowerShell Actions under Approve & Reject actions and choose ‘Script Library/Sitecore + Microsoft Teams Integration/Workflow/Approved Notification’ & ‘Script Library/Sitecore + Microsoft Teams Integration/Workflow/Rejected Notification’ for ‘Script’ field respectively
  • If you’re using Sitecore Powershell Extensions version 6.1.1 or older, you will be needing to update the ‘Type string’ field value as ‘Sitecore.MicrosoftTeams.Integration.Workflows.ScriptAction, Sitecore.MicrosoftTeams.Integration’ (this ScriptAction class comes with the module) for ‘Approved Notification’ and ‘Rejected Notification’ items in case if you face the error described in https://github.com/SitecorePowerShell/Console/issues/1204

The configuration is now complete!
Awaiting Approval, Approved and Rejected Notifications should now be appearing in the configured Teams Channel.
Voila!

Come Here Lets Go GIF by Luis Ricardo (GIF Image)

Investigating Audit Logs with Sitecore Powershell Reports

Very often Content Administrators seek history of activities performed on an item like edit, publish, workflow approval etc. Though we have options like Sitecore Log Analyzer, it requires developers’ assistance while it is critical to equip Content Administrators to function independently.

Sitecore Powershell comes with a super cool report, ‘Find Audit Trail from logs’ which crawls through the logs for the specified timeframe yielding all the audit logs (without exceptions etc. ;), Sitecore Log Analyzer will need to be used for analyzing exceptions). I haven’t seen much mention of this report and speaking to a few people it seems to have been missed/unnoticed. Here is how you can access the same,

Like any other Sitecore Powershell report, we do have the export and filter options available in this report as well, which makes our life easier.
We experienced one issue which was specifically due to an error in the format of certain log entries,

Few log entries in our instance were having a weird additional spacing before the thread id though the log4net conversionPattern etc. were correct. This appeared to the root cause for the above issue,

Updating the following line to remove empty entries fixed the issue,

By default Sitecore Powershell Reports are enabled only for Administrators. When it is needed for other roles, we will be needing to provide read access to /sitecore/content/Documents and settings/All users/Start menu/Right/Reporting Tools/PowerShell Reports item in core database.

If we are looking to provide access only for this specific report, then deny access will need to be added to other reports under /sitecore/system/Modules/PowerShell/Script Library/SPE/Reporting/Content Reports/Reports item in master database. It is important to note that the Content Author will be able to view history of activities performed on all the items including the ones for which they might not have access.

This Report was introduced in Powershell Extensions 5.0, if you are using an older version, you could use this package.

If you are using Sitecore PAAS with Azure Application Insights, you will be needing Application Insights App ID/Key and will be needing to fetch the logs using Azure Application Insights Queries. The below blog will be helpful for PAAS setup, https://www.sitecoregabe.com/2019/09/azure-application-insights-logs.html

References:
https://www.sitecoregabe.com/2018/08/basic-sitecore-audit-trail-with.html
https://github.com/SitecorePowerShell/Console/issues/1033