Automate Compliance Asset Id on SharePoint Documents

Reading Time: 5 minutes

For anyone working with event-driven retention in Office 365, you’ll need to know how to set the Compliance Asset Id. The Asset Id is a column automatically added to any list or library in SharePoint that has had an event-driven retention label published to it. Although you won’t see this column in library settings, you will see it on the property detail pane and it can be added to any SharePoint view.

This column is really important for event-based retention! It’s what will be leveraged to be able to apply retention to documents and emails when an event occurs.

Examples of Asset Id:

  • All employee documents might have an Asset Id of their unique employee #
  • All litigation case files might have an Asset Id of their legal case file #
  • All project documents might have an Asset Id of their unique project #

On a related post, Automate Event-based Retention in Office 365, I demonstrate how to apply event-based retention to a Project’s documents when the Project is completed. The document’s Asset Id is an important part of that solution.

For event-based retention to work in that post, the Asset Id on all Project documents covered by the retention had to be tagged with a consistent Asset Id. For example, if everything for Project ‘X’ was tagged with Asset Id ‘12345’, then when Project ‘X’ was complete, anything tagged with Asset Id ‘12345’ with an event-based retention label applied would start its retention.

There are currently 2 options for setting an Asset Id:

Option 1: Manually set it like any other piece of metadata by an end-user. Not ideal.

Option 2: Automated based on some criteria.This could be on ALL documents in the library or you could selectively apply an Asset Id on specific types of Project documents (i.e. Project Charter, Project Change Requests, Project Design, etc.)

This post will demonstrate Option 2 above using a Project Document library as an example.

Special thanks to my MVP colleague, Antonio Maio, for his consultation and verification of some of the content of this post.

Important to know about the Asset id column:

  • You cannot default the Asset Id at a site level
  • You cannot default the Asset Id at a library level thru the UI, however you can default it using PnPPowerShell (see below)
  • You cannot default the Asset Id on a folder and utilize the column default value setting, however you can default a folder (and document set) using PnPPowerShell (see below)
  • You can automate the Asset Id at a document level thru code or a Flow (this post!)
  • You can manually set the Asset Id at a document level
  • Coming soon: you’ll be able to default the Asset Id on a Document Set which will propagate the
  • value to all documents within the document set

[Update Mar 3, 2019] Shout out to a Twitter friend, Graham Tyler, for showing me how to update a Compliance Asset Id using PnPPowerShell. You can either default an entire library to the same Asset Id, or set an Asset Id on a specific folder. Here is the cmdlet details:

Set-PnPDefaultColumnValues -List “listname” -Folder “/relative folder name” -FIeld “ComplianceAssetId” -Value “yourAssetId”


Steps to set the Asset Id

First thing to determine is the Asset Id you will use for your documents. In this example, I’ll retrieve the Asset Id from a SharePoint list of Corporate Projects called ProjectRequest. This list is also used for an auto-provisioning process for Project sites and so contains any metadata required for provisioning a Project site. This makes it a great place to also store the project’s unique Asset Id.

Your Asset Id could be an employee #, unique legal case file #, a project #, a RFP #, etc.

Build a Microsoft Flow

This Flow is triggered on an add/update on the Project Documents library on the Project site. It will set that Project’s documents’ Asset Id to the value stored on the above ProjectRequests list. The Flow will:

  1. Retrieve the unique Asset Id for the project
  2. If the Asset Id isn’t set for the document, set it

There are a few technical details important to this solution. Shout out to Twitter colleague, Siddle for Business, who helped steer me in the right direction on how to update the Asset Id on a library, something I was having trouble doing up until he helped out. Give him a follow on Twitter! 🙂

Important: since the Flow trigger is on an add/update event and the Flow is also updating a property on the same document (ComplianceAssetId), be careful not to get in an endless Flow loop! To avoid this, ensure you have a condition at the start of the Flow that will evaluate to false after the first update. In my case, I only update the Asset Id if it is not already the correct Asset Id value.

Here are the relevant 3 steps of the Flow to update the ComplianceAssetId property:

Step 1: Compose the header of the request

Step 2: Compose the body of the request ensuring you’ve identified the correct Asset Id to associate to each document.

Step 3: Send an HTTP request action to update the Asset Id on the document library. The ValidateUpdateListItem method is called to avoid creating a new version of the document on this update.

Once done, the Asset Id will be automatically updated on every document added to the library. This will allow any document tagged with the Asset Id to be processed when an event-based retention label is associated to the library.


Thanks for reading.

-JCK


Feel  free to comment on this post. Would you like to connect with me to ask  a more complex/involved question? I’d love to support you in anyway I can. Book a call with me on Pick My Brain! There is a charge for the Pick My Brain call.

16 comments

  1. Another great post as always!
    Online I see some mixed info about the ComplianceAssetId with regards to Search. What are your experiences: does it crawl, is it searchable, is it query-able, usable in the default web parts?

    1. Hello,
      The managed property for ComplianceAssetId is automatically generated for you. It’s settings are queryable and retrieveable. To answer you questions… yes, that property is crawled, it’s queryable, you can query it from the Microsoft Search box. I’ve never tried it in the default web parts.
      Hope that helps.
      -JCK

  2. Excellent post, thank you! Have you heard any updates about the timeline for being able set the Asset Id on a Document Set and have it automatically sync to the documents within?

  3. Very informative article. I have a question. You state “The Asset Id is a column automatically added to any list or library in SharePoint that has had an event-driven retention label published to it.” I pulled a list of columns using PowerShell and these Asset Id column (Compliance Asset Id) is showing up, despite the fact no Retention Labels have been published. Do you know if they are now just adding those columns automatically?

    1. Hi Brite, i guess i meant “visible thru the UI”. I would suspect (as your PS has shown) in the backend they are always provisioned but only leveraged if an event-driven label has been published to the site.
      -JCK

  4. Hello Joanne. I really like your posts. I am trying to configure some event-based retention labels to better understand this framework. However, I cannot manually edit or set a value for Compliance Asset ID. I can add it as column to library views, but It does not come up in the entry forms nor can I enter a value through Quick Edit. I thought manual edits were allowed. Do you know if I may need additional configuration to enable edits?

    1. Hi Debora, I’m not in front of my laptop but i think you have to publish the event-based retention label to the site first. Have you done that? If you’ve done that, you may need to apply it to at last one document in the library to start to see the column. Let me know if that works.
      -JCK

    2. I had been using Chrome but decided to see if IE would make a difference. I did not think it would i this case, but, to my surprise, the Asset ID became visible and edit in the Properties form. I thought Chrome was supported for SharePoint Online.

      1. Thanks for your reply JoAnne. I had published the event-based label and was able to apply to documents. I was just not able to set an Asset ID until I switched to IE. I was surprised by the difference in behavior between the two browsers.

  5. Debora, i had initially the same issue, that the Asset Id didn’t shown’t up. However what i recognized is that this field only becomes available/required for files which based on the retention label require it. Once i applied the event based label it was available, worked in IE as well as in chrome. I thought i could apply the asset id independent of the label, but it looks like “not required , not available” nature of this field.

    1. Thanks for your reply. But the field became available for edit as soon as I used IE instead of Chrome so the label was one that required Asset IDs. Now that I set a value in IE, I can see the field in Chrome and it is editable, but when I edit it in Chrome, the changes are not saved. It is a very peculiar behavior.

  6. This is great Joan! One question I have is, is there a way to get the Retention Label of a document in a Flow?

    1. Hi Pat,
      I don’t know. This is a great question and once I find the answer, I’ll turn it into a blog post.
      -Joanne

      1. That would be awesome! I know it’s the ComlianceTag column, but I’ve scored what’s returned in “Get file (properties)” and other actions to pull files and can’t find it anywhere 🙁

Leave a Reply to Pat WilliamsCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.