Views:

Scenario Overview

In this scenario, we will move the attachments from the notes on an account to that accounts SharePoint folder.

We are using Dynamics 365 Online and SharePoint Online for this example and have structured the formula to handle the standard out-of-the-box behavior from Microsoft.

To do this we will use a single North52 Formula with a Quick Button to trigger it.

N52 Formula Manager Solution - Decision Table

The Formula Manager solution works like this,

  • We create a formula of type 'ClientSide - Calculation' on the Account entity
  • When fired by the button the formula will get a list of all notes connected to that account
  • Any attachments it finds among the notes will be uploaded to  that accounts SharePoint


 
As Microsoft by default attaches the guid (with the hyphens removed) to the SharePoint folder name, we do the same to specify the folder the file is being sent to.

To use this in your own instance of Dynamics 365 all you would need to do is update the SharePoint URLs from https://north52.sharepoint.com to your own SharePoint URL and update the username and password.

Formula 

ForEachRecord(  FindRecords('annotation',
                           'objectid',
                           [account.accountid],
                          '*','50','true'),  iftrue(CurrentRecord('isdocument') = true, 
              SetVar('FolderLocation', 
                     'https://north52.sharepoint.com/sites/north52/account/' + 
                     [account.name] + 
                     '_' + Replace(ToString([account.accountid]), '-', '')),
               SharePointCreateFile('https://north52.sharepoint.com/sites/north52', 
       '                           admin@north52.com',
                                  'Password', 
                                  true,
                                  true,
              GetVar('FolderLocation'),
                     CurrentRecord('filename'),

                     CurrentRecord('documentbody')     ),
                    UpdateRecord('annotation',
                   CurrentRecord('annotationid'),
                   SetAttribute('notetext', '123'), 
                   SetAttribute('documentbody', '?'),
                  SetAttribute('filename', '?'),
                  SetAttribute('filesize', '?'),
                  SetAttribute('isdocument', 'false'),
                   SetAttribute('notetext', CurrentRecord('notetext')
                   + '\r\n\r\n'+
                  GetVar('FolderLocation') +'/'+ CurrentRecord('filename'))
                   )       ) )

  

SharePoint Set-Up

To configure Dynamics 365 to communicate with SharePoint you must carry out the following steps:

Navigate to Settings -> Document Management.



Select Enable Server-Based SharePoint Integration.




Click Next - then select Online for the Integration




Enter the URL for the SharePoint site. 

Click Next and then Enable



Hit Finish and this step is complete.




Next select Document Management Settings 



Enter the URL for the SharePoint instance again and click Next


Use the screen below to configure the Document Management Settings.


Hit Next and then Finish and the Integration between SharePoint and Dynamics 365 is now configured.

The file transferred to SharePoint.



To add a Quick Button to the Account entity in Dynamics 365 - please see our detailed guide here.

Wizard - FindRecords

FindValue() function call used in this formula. 

Note to find the value for Equals Value, you will need to go to the Source tab , expand Source and click on Account 
 
 

Did you know?

North52 Decision Suite works with vanilla Common Data Service instances

The North52 Decision Suite works with Common Data Service instances which have not had any Microsoft 1st Party apps applied (Field Service, Customer Service, Sales Enterprise, etc). This means you can use our no-code advance business rules engine in your custom Model Driven and Canvas Power Apps! 

It is the same solution which has been powering Microsoft Dynamics 365 CR/CE for many years. You get a mature, robust solution with proven capabilities (over 500 functions) that allows you to build complex decision logic for use in your custom apps.

Learn more about the North52 Decision Suite or contact our team for more information