Views:

Scenario Overview

In this scenario, 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

For this solution, we will be using 4 xCache Records:

  • 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

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 and only if the Regarding is populated by an Account
  • 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

                       

North52 Decision Suite Steps 

The following set of steps will set this formula up for you.

  • Create a new formula of type 'Save - To Current Record'
  • Set the Source Entity to 'Document Location '
  • The Event is 'Create only'
  • Set the Target Property to 'Relative URL '
  • Create the xCache Records for the Site URL, Username, Password & the Collection you are using
  • Copy and paste the formula below into the formula canvas
  • Save the formula
  • Click Save and you are ready to test

Formula : Classic

IfTrue(ContainsData([sharepointdocumentlocation.regardingobjectid]) and 
  [sharepointdocumentlocation.regardingobjectidtype] = 'account',

  SmartFlow(

    SetVar('Continent', [sharepointdocumentlocation.regardingobjectid.new_continent_fmt.?]),                                                        
    SetVar('Country', [sharepointdocumentlocation.regardingobjectid.new_country_fmt.?]),
    SetVar('City', [sharepointdocumentlocation.regardingobjectid.new_city_fmt.?]),

    If(ContainsData(GetVar('Continent'),GetVar('County'),GetVar('City')),
      SmartFlow(
        SetVar('FolderPath', GetVar('Continent')),
        SharePointCreateFolder(
          xCacheGetGlobal('SharePoint_Site'), 
          xCacheGetGlobal('SharePoint_Username'), 
          xCacheGetGlobal('SharePoint_Password'),
          true,
          xCacheGetGlobal('SharePoint_SiteCollection') + GetVar('FolderPath'),
          true),

        SetVar('FolderPath', GetVar('FolderPath') + '/' + GetVar('Country')),
        SharePointCreateFolder(
          xCacheGetGlobal('SharePoint_Site'), 
          xCacheGetGlobal('SharePoint_Username'), 
          xCacheGetGlobal('SharePoint_Password'),
          true,
          xCacheGetGlobal('SharePoint_SiteCollection') + GetVar('FolderPath'),
          true),

        SetVar('FolderPath', GetVar('FolderPath') + '/' + GetVar('City')),
        SharePointCreateFolder(
          xCacheGetGlobal('SharePoint_Site'), 
          xCacheGetGlobal('SharePoint_Username'), 
          xCacheGetGlobal('SharePoint_Password'),
          true,
          xCacheGetGlobal('SharePoint_SiteCollection') + GetVar('FolderPath'),
          true),

        SharePointDeleteFolder(
          xCacheGetGlobal('SharePoint_Site'), 
          xCacheGetGlobal('SharePoint_Username'), 
          xCacheGetGlobal('SharePoint_Password'),
          true,
          xCacheGetGlobal('SharePoint_SiteCollection') + [sharepointdocumentlocation.relativeurl])
      ),
      SetVar('FolderPath', [sharepointdocumentlocation.relativeurl])
    ),
    SmartFlowReturn(GetVar('FolderPath'))
  )
)

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 Enable Responsive Businesses

You can make, test, and deploy changes to decision logic without software development. Rather that waiting weeks or months for internal or external developers to make needed updates and changes, they can be made by business analysts as they are needed.

Decision Tables within the North52 Decision Suite provide a business-friendly representation of the decision logic so that business analysts can define how the decisions are made. As you define your decision, you can test and validate the decision approach and when ready, deploy the decision logic to your production instance.

Learn more about the North52 Decision Tables