Microsoft Team for each Key Account using Conditional Rules in DocDrive365

   Words by Paul McQuillan

   on 20/01/2021 06:00:00

The standard use of DocDrive is to configure the set of rules for how Documents should be stored for Records of that Entity or Table in Power Apps or Dynamics.

But what if we need to have branching logic for different types of record within the same Entity?

Commonly this crops up when we look at Companies we work with, and some of these can be Key Accounts or Customers that we may want to track a more detailed set of documents over a non-key account.

This often appears when we want a new Microsoft Team for a Key Account or Customer, and a Folder in a standard Document Library for a Supplier or other Company Account.

This guide will show how this can be configured.

Find our Entity

To start with we open the Entity Definition for our intended Table in the DocDrive365 Model App, in our example we will look at the Account Entity.

This will usually have a number of rules looking like the following:


This will typically include a pair of Bucket and Record Rules defining a Document Library as the ‘bucket’ to place each new Folder for an Account Record.

These rules will currently be non-conditional and so running for all Accounts - so our first time is to make these two conditional.


Conditional Rules

We can open both our Rules and look at the list of Conditions for each Rule.

For a Non-Conditional Rule, this will be blank.

In Power Apps this is a Many-to-Many relationship between the Rule and the Condition - so we can attach an existing Condition we have already defined, or create a new Condition for our logic.

We can start from scratch by creating a new Condition to only carry out this Rule if the [Relation Type] field is not ‘Customer’.


With this condition created, we can attach to both the Bucket and Record Rules:


This then means that only Non Customer Accounts will be valid for these Rules to store documents via the basic Document Library and Folder combo.

Microsoft Team per Account

Now we can look at defining our alternate flow if the Account is a Customer.  We do this by defining a 2nd Record Rule that defines that DocDrive should create a new Team for each Account as per the following:


We then make this Conditional to define which Accounts should be represented by a Team in Microsoft Teams - in my case, a Condition that allow does this is [Relationship Type] is ‘Customer’:



With this combination of Conditional Record and Bucket Rules our Entity Definition will look like:


Testing for a Non-Customer

We can then create new Account Records to test how this works for our Customers and Non-Customers.

Starting with Non-Customers, we can track a new Account and review the Location created for us in SharePoint.



Testing for a Customer

Whereas if we create a new Account and flag the Relationship Type as Customer, this will create differently into SharePoint or in this instance, MS Teams.


We can see the result in Microsoft Teams:


Or by clicking Location to browse into SharePoint directly:


Non Customer to Customer?

On key element is that often an Account or other Record will upgrade or qualify to a Key Account in Dynamics, and so go from meeting the original set of Conditions to a different Condition.

If or when this happens, the logic in DocDrive will pick up on the change and adjust the Document Location automatically.

So if test it an initially non-key account:


This is reflected as a Folder in SharePoint.

But on changing the Relationship Type, this promotes into a new Team:


If need be, we can then demote back into a non-key account and go back to the Folder – this does not however automatically delete the Team (or any previous Location), just reversing the location that the Record in Dynamics is associated with.

This swapping of locations as the Account changes which Conditions are met (and so which Record and Bucket Rules are applicable) – does not automatically copy or move Documents between the Locations, this remains a manual process but can be automated using Flow via the DocDrive Connector.

Correctly configured, for each New MS Team created will come with pre-installed with the DocDrive Teams App.

This App allows for Posts and Updates to be posted from Dynamics into Teams – either as simple Messages or detailed Adaptive Cards.

The App also enables the DocDrive Bot in the Teams to allow commands to be raised from Teams to find or raise new information in Dynamics.

Share this Article

Search Articles

Filter Articles

CRM Tech DocMan

Recent Articles

Power Apps Portal Information Hub DocDrive365 Security: Day One - Getting Started with Dynamics to SharePoint Permissions Part 5 - Power Apps Portals: How To Connect Azure B2C With Linked-In Part 4 – Power Apps Portals: Styling Azure B2C for Power Apps Portals The 3 Phases for Using Multi-Select Option Sets in Flow with Microsoft Forms Part 3 – PowerApps Portals: Azure B2C and Power Apps Portals – User Flow for Signup and Signin Part 2 - Power Apps Portals: New Application Registration in Azure B2C for our Power Apps Portal Part 1 – Power Apps Portals: Creating a New Azure AD B2C Tenant The Automation Bot: Launching Contextual Flow from Teams Creating a New Bot for Teams Debugging your Teams Bot using Ngrok Adding a Microsoft Teams URL to a Dynamics Appointment Using Power Automate to Create a New Channel for a Record in Dynamics Connecting your Docusign Account with DocDrive365 for eSignature in PowerApps Showing or Hiding a SharePoint Metadata Column within Dynamics Running a Quick, Quick Campaign from Dynamics Dynamics for Sales: Use Word Templates to Export directly to PDF Newly Generated Documents in Dynamics or Power Apps do not save into SharePoint Synchronising Dynamics / Power Apps Security with SharePoint Adding the DocDrive Bot to each new Microsoft Team Microsoft Team for each Key Account using Conditional Rules in DocDrive365 Azure B2C–the Subscription is not Registered Using Power Automate to Integrate Microsoft Forms with Dynamics 365 CRMCS Quick Start Guide: How To Produce a Microsoft Teams Live Event Dynamics 365 Marketing: Lead Scoring and Sales Acceptance
Contact Us

Want expert advice or a demo?

Get in touch now and see how we can help your business grow.

  • Name
  • Email Address
  • Phone Number

Understanding Your Challenges

Our strong understanding of CRM and emerging technologies within the Microsoft environment means we deliver the right solutions for you.

Proven Real-World Solutions

As a leader in the field of Dynamics solutions, our pedigree developing and delivering real-world solutions is unsurpassed.

Long Term Support

We provide support beyond our design, implementation and 'go-live' delivery using Sprints and continual updates to our AppSource apps.

CRMCS | Design by Thinktank Marketing | Citrus-Lime Limited

To improve your experience today and in the future, this site uses cookies. Read our full Privacy Policy & Cookie information here I Understand