Behavior of document check-in in a SharePoint Document Library (with Required Columns) when starting K2 Workflows

Question: Can I use Remote Event Receivers (RERs) to automatically start K2 workflows, based on events in a document library, when that document library has Required Columns that do NOT have default values configured?

Answer: No. In this scenario, SharePoint will force a check out of the document to the person who uploaded that document, until they are finished providing values for all the required columns. RERs use system-to-system communication and the K2 application account tries to access the document when the workflow starts. But since K2 does not have the token for the user that caused the event to fire and the document is still checked-out, there is no way for K2 to get past this state. To avoid this issue, you must design the Document Library and set default values for all required columns if you do not want SharePoint to force a check out until all required columns have been populated.

There are also differences in behavior depending on your version of SharePoint.

  • SharePoint Modern UI (used in SharePoint Online by default), behaves differently to SharePoint Classic UI when you upload a file to a document library with required columns. When the library setting Require Check-out is set of Off, the setting is ignored when uploading a document. In Modern UI, the file will not be checked out when uploading. In Classic UI: the file will be checked out when uploading.
  • Uploading a file to document library with required field having default value configured does not show the Information Panel for required value. This behavior is by-design, and SharePoint simple sets the default value of the required field and no check-out occurs.
  • When using Modern UI, uploading a single file to a document library (where required columns do not have default values configured) creates two versions. This behavior is by-design for SharePoint Modern UI. To avoid this issue in Modern UI, you need to explicitly check the file in (using the checked-out version of the document).
    • You will not see this issue with Classic UI, because in Classic UI, the file must be checked out when uploading.
  • A currently-known issue is that when uploading a large file (e.g. size > 40MB) in Modern UI, only one version is created. This is a bug in SharePoint. After a fix is shipped by Microsoft, the behavior will be same as uploading a small file. You will see two versions in history (one without required value, and one with required value).

For more about versioning in SharePoint, please see the Microsoft article How does versioning work in a SharePoint list or library.

To work around this versioning behavior by SharePoint, your workflow may need to start based on the checked-in event, instead of item added event. But, this also means the workflow will start whenever the document is checked-in, so you may need to use conditional start rules or decision steps in your workflow to avoid starting or continuing the workflow if a workflow instance is already active for that document.