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.

North52 Decision Suite Solution - Decision Table

The North52 Decision Suite 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 to your own SharePoint URL and update the username and password.


ForEachRecord(  FindRecords('annotation',
                          '*','50','true'),  iftrue(CurrentRecord('isdocument') = true, 
                     '' + 
                     [] + 
                     '_' + Replace(ToString([account.accountid]), '-', '')),
       '                 ',

                     CurrentRecord('documentbody')     ),
                   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?

You can easily copy/clone test data in TestShield

Once you have set up test data with TestShield it is easy to create a copy/clone and make changes. It is centrally stored so that all users creating tests can use the test data in their tests. This approach dramatically reduces the time it takes to create tests, enabling teams to deliver Dynamics 365 projects faster and at less cost.

Learn more about TestShield