In this scenario, we will copy the attachments from the notes on an account to that accounts SharePoint folder. We will then delete the attachments on the notes to free up space on CRM.
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 documents it finds among the notes will be uploaded to 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.
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', 'email@example.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')) ) ) )
To configure Dynamics 365 to communicate with SharePoint you must carry out the following steps:
1. Navigate to Settings -> Document Management.
2. Select Enable Server-Based SharePoint Integration.
3. Click Next - then select Online for the Integration
4. Enter the URL for the SharePoint site.
5. Click Next and then Enable.
6. Hit Finish and this step is complete.
7. Next select Document Management Settings
8. Enter the URL for the SharePoint instance again and click Next
9. Use the screen below to configure the Document Management Settings.
10. Hit Next and then Finish and the Integration between SharePoint and Dynamics 365 is now configured.
11. The file transferred to SharePoint.
Note 1 : To add a Quick Button to the Account entity in Dynamics 365 - please see our detailed guide here.
Wizard - FindValue
Please see below the wizard you can use to create the 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's TestShield provides 3 different test types
TestShield currently support 3 test types: Process Shield, API Shield and Data Shield.
Process Shield - Testing of end-to-end processes – learn more
API Shield - Testing APIs to ensure they are working as expected – learn more
Data Shield - Ensure that your data hasn’t changed or falls outside of thresholds – learn more