Scenario Overview

This example follows on from xRM Formula #111 and demonstrates how to solve the custom SharePoint folder structure requirement using a Decision Table instead of the Classic style formula.

The business requirement from the customer was that they did not want to use the standard Sharepoint folder structure. Instead, they are grouping their documents by geographical location.

Continent -> Country -> City

This is determined by 3 OptionSets on the Account record.

xCache Records

We will be using the same 4 xCache Records from the earlier formula:

  • SharePoint_Site: Contains the URL to the SharePoint Site we are using
  • SharePoint_SiteCollection: Contains the URL to the Collection we are working with on SharePoint
  • SharePoint_Username: Username to access SharePoint 
  • SharePoint_Password: Access Password for SharePoint

North52 Decision Suite Solution - Decision Table

The North52 Decision Suite solution works like this,

  • We create a formula of type 'Save - To Current Record' on the Document Location entity
  • The formula will fire on Create of the Document Location only.
  • It will create the necessary folders if they don't already exist
  • It will delete the folder created on SharePoint automatically
  • Then it updates the relative URL field on the Document Location to the new folder path


This Decision Table uses 4 calculations. 3 will retrieve values from the entity in the Regarding field. The fourth will return a True or False value confirming if each of the fields contains data.







SharePoint Fields Filled Out



We use 2 actions in this Decision Table, the first one will create the folders using the value that is currently in the FolderPath Decision Table Calculation. The second is used to delete the folder automatically created by Microsoft out on SharePoint which automatically creates even before the creation of the Document Location entity in Dynamics 365.


  xCacheGetGlobal('SharePoint_SiteCollection') + GetVar('FolderPath'),


  xCacheGetGlobal('SharePoint_SiteCollection') + [sharepointdocumentlocation.relativeurl]

The Document Location on the Account

SharePoint Folder

Wizard - xCacheGetGlobal

Please see below the wizard you can use to create the xCacheGetGlobal() function call used in this formula. 

Note you will need to create the xCache beforehand. 

Did you know?

Decision Tables Simplify Complex Logic

Decsion Tables allow you manage complex business logic without code.  Key features include:

  • Simple visualization in a compact table format
  • Promotes grouping of rules in a single table
  • Business logic can be controlled by domain experts

A Decision Table represents multiple related business rules by using conditions, actions and data values in a spreadsheet-style table. The Decision Table uses columns for the conditions and actions of the rules and rows to represent the associated data values.

Learn more about Decision Tables