DocDrive365 Day Three: Opportunities and Bucket Folders

   Words by Paul McQuillan

   on 15/11/2019 10:00:00

We have seen how DocDrive can create new Document Libraries and Folders for records in Dynamics, and how related records can form the structure for how our documents are stored.

We can also look at the concept of ‘bucket’ folders that can build not just a Folder for a Record, but also other ways of dividing record’s into a logical set of document locations.

So we could potentially divide how we store the Documents for Opportunities by the Type of Opportunity,  or by the Month or Year when the Opportunity was created – this helps keep our Document Structures manageable and governable, and avoid the problem of having a big long list of Folders that can make navigation more difficult.





Lookup Rule

Link up to the Parent Account


Link up to the Parent Account


Bucket Rule

Group Folder by Opportunity Type

New Business

Group Folder by Year


Record Rule

Folder per Opportunity

Equipment Supply

Folder per Ticket Number


Before we look at how this is done for Opportunities in the initial DocDrive Configuration, we can actually see this concept in the definition of the earlier Account Entity.


Here we can see the top DS3 Rule defining a ‘bucket’ location to use before the DS4 Rule then creates a Folder per Account.

Drilling down into this rule gives us a basic definition to use or create a Document Library in SharePoint as the bucket, and that this Document Library should be created with a simple fixed title of ‘Client Documents’.


Looking at Opportunities, we can also see this bucket rule concept in evidence with each Opportunity we open.

Picking an Opportunity and clicking LOCATION in the DocDrive Panel or the Dynamics Documents List will show us the following way we have defined for Opportunities to be managed:


We can see that the Opportunity’s Document Location is being built via:

1. DS2 - Parent Rule looking up to the Folder for the Company Account

2. DS3 - Bucket Rule defining that all Opportunity Folders should be tracked in a fixed folder for ‘Opportunities’

3. DS4 - Record Rule adding a new Folder for each Opportunity

This structuring is available in the DocDrive Entity definition for Opportunity – as we can see our respective three rules in the definition:


This is a similar ‘fixed’ bucket to put our Opportunity Record Folders in.

However we can change this to start using a non-fixed Bucket Folder that would instead depend on a Field in the Opportunity record itself – so say we wanted to model the scenario where our Opportunities were sub-divided by the Currency involved in the Opportunity, then we would amend our Bucket Rule to create a Folder based on the ‘transactioncurrencyid’ field of the Opportunity.

To do this, we would change the [Map Type] from ‘Fixed Mapping’ to ‘Field Mapping’, and set the [CRM Field] to the Database Name of the Field we want to use.

We can also reset the [Template / Fixed Value] to use the CRM Field we want to bring in – so we can set this to ‘{0} Sales’ as way of using the value of the Currency Field and then following with Sales so the resulting Folder is clear.

The [Data Type] we can leave as String in this incidence, as this will simply ask DocDrive to interpret the Lookup Text of the Currency Field using its Text/String definition:


NOTE: This type of mapping and choosing whether to use the Value or Text of the Field can be done for Option Sets, Lookups, Dates or any other type of Field we track within Dynamics.

With this in place in the DocDrive Configuration – we can see this in action.

If we create a New Opportunity and set the currency to ‘US Dollar’, we will see this reflected in SharePoint as {Account Name} >> US Dollar Sales >> {New Opportunity Name}


This gives us a way of sub-dividing groups of Opportunities within the structure of the Parent Customer Account – if this is useful to us.

This concept of a Dividing Folders or Document Libraries by a Bucket can be put to use in a variety of scenarios to help ensure we get the structure of Document Management right between our Records in Dynamics and SharePoint.

Do Changes to the DocDrive Configuration take effect immediately?

Yes – DocDrive does a range of caching behind the scenes, but refreshes this cache when a change is recorded to the DocDrive Entity or Rule records.

What happens to existing Records and SharePoint Folders?

Nothing happens for already existing records – any rule changes in DocDrive update the logic for new records being added to Dynamics, but do not change existing records.

This is to keep the consistency of existing Links and SharePoint Locations even when the Rules change; and corresponds to how Dynamics stores the Document Locations to associate Records in Dynamics to SharePoint Locations.

This gives an initial view of Bucket Rules to work in tandem with Record Rules, we will see this again when looking at the Case Entity in the initial configuration from the DocDrive Wizard and how this uses the Date of the Case as a Bucket Rule.

This configuration allows to configure what happens up the chain in terms of the Lookup to Rule and now this Bucket Rule, but we can also look at down the chain in terms of having Sub-Folders from our record.

But before we do, it may be useful to reference a quick guide for how records in Dynamics can be renamed or deleted to update the Location in SharePoint.

Get in touch and see a demo of DocDrive in action

  • Your Name *
  • Your Email *
  • Tell us a bit about what you are looking for?
* Required before sending

Our Clients