Gravity Union

View Original

Use Power Automate for event-based retention in Microsoft 365

Although Microsoft 365 (M365) Records Management provides out-of-the-box functionality to apply retention policies automatically based on an event, it does require either a Microsoft 365 E5 license or an Office 365 E5 license, which may be out of reach for some. Furthermore, it also requires end users to let Record Managers, or IT know when an event, such as a Contract has expired or an Event has closed, so that the event can be triggered in the Compliance Centre to begin retention, rather than updating the status intuitively through the front end in SharePoint, where the content lives.

Luckily, there is another way to achieve event triggered retention using Microsoft Power Automate.

Getting started with event-based retention

To begin, setup your sites and libraries by engaging business end users and designing a solution that fits their needs. Make sure to capture the metadata that helps users organize their work by statuses, dates, and other crucial information to track progress.

In this example, we will set up retention for an organization’s Events. The retention starts when an event has ended, or the status is set to closed. We created a document set content type called “Event”, and added an “Event Status” column. End users can tag an event as “Open” or “Closed”, allowing them to filter events in the library to show open or closed events, while also allowing us to run event triggered retention in the background.

Events library in SharePoint with example items

Then in the M365 Compliance Centre’s Records Management section, instead of setting up one retention label for “Events”, we create two (2) separate labels, one for Open Events, and one for Closed Events:

Retention labels

The “Open Events” retention label allows us to:

  1. Not run any retention workflows but still be able to classify the content as an event that is currently open, so that we can make sure all content in the system is classified, rather than waiting to classify only when retention starts (when the event is closed)

  2. Wait for the event trigger by the end user to set the event as closed

The “Closed Events” retention label allows us to:

  1. Apply the actual retention for the content (such as keep content for 7 years after the event is closed)

  2. Conduct disposition review at the end of the retention lifecycle specified above

Now that we have the retention labels setup in the M365 Compliance Centre, we can go ahead and apply “Open Events” as the default retention label in the “Events” Library by going into “Library Settings”, and under “Permissions and Management”, click on “Apply label to items in this list or Library”:

Setting up label to apply on a SharePoint library

This will allow any content in the “Events” library to be classified with the retention label “Open Events”. Now we are ready to design a Power Automate workflow to wait for the “Event Status” to change from “Open” to “Closed”, and then update the retention label (record classification) to “Closed Events” and start actual retention.

Setting up the Power Automate flow

Step 1:

Setup the Trigger for the Power Automate Flow as “When an item is created or modified” and select your site and library.

Once your trigger condition is created, click on the three dots (ellipses) and then settings to setup the Trigger condition for your flow.

This will stop your flow from triggering unless the “Event Status” column is set to “Closed” or in case there are other metadata changes that should not trigger the flow:

@equals(triggerOutputs()?['body/EventStatus/Value'],'Closed')

Notes:

  • Replace “EventStatus” with the internal column name of your status field

  • Replace “Closed” with the actual spelling of the choice for your status field

Step 2:

Send an HTTP request to SharePoint to update the retention label to “Closed Events”: 

Send an HTTP request to SharePoint

Uri:

_api/web/lists/GetByTitle('Events')/items(@{triggerOutputs()?['body/ID']})/SetComplianceTag()

Headers:

{
“accept”: “application/json;odata=nometadata”,
“content-type”: “application/json;odata=nometadata”
}

Body:

{
"complianceTag": "Closed Event",
"isTagPolicyHold": "False",
"isTagPolicyRecord": "False",
"isEventBasedTag": "False",
"isTagSuperLock": "False"

And you are done! All content inside the “Events” library will now be auto labeled and classified as “Open Events” to start, and once the end user updates the “Event Status” to “Closed”, the Power Automate flow will run and re-classify the content to “Closed Event” and start the clock on the retention schedule you have set.

Retention label automatically applied

Recommendations and considerations

Here are a few topics to consider when taking this approach for event triggered retention:

The Power Automate plan you have

We recommend having the per user plan that allow individual users to create unlimited flows based on their unique needs

Thoughtful design process

We recommend a good design process to identify areas where event triggered retention is required. For each type of record needing event triggered retention, such as Events (closed), Contracts (expired), Bylaw (Repealed), etc., you need to create a separate Power Automate flow to wait for the status change and apply the retention label that starts retention.

A naming convention as your flows scale

We also recommend having a naming convention for these flows to help organize and easily find them, such as:

  • [RM – Retention Label Reference ID – Retention Label Name]

  • RM – T0005 – Event Closed

You will not need hundreds of flows to manage event triggered retention

Even if you have hundreds of libraries in your organization across tens of Departmental sites, each with a custom content type, only 10-15% of them will be event triggered and need the flow created to manage their retention.

The rest are time triggered, such as financial records, where retention begins not by a status change, but 7 years after the creation of the content, and can be managed with a single retention label in M365 RM without the need for a Power Automate flow.

Save documents related to an event trigger in one library

Since Power Automate flows runs on a per library basis, this method unfortunately does not work if content is stored across libraries and/or sites. If your content is stored across libraries and sites, the out of the box M365 Event triggered retention may be better suited for your needs instead.

In closing

While this method of automating retention requires a few steps to configure, it’s an option for organizations who don’t have access to the full enterprise license features of Microsoft 365.


Have a specific Microsoft 365 retention situation you need advice on? Reach out to us to discuss, and we’d be happy to recommend a path forward.


Related posts from the blog

See this gallery in the original post