{"id":297,"date":"2022-01-18T11:05:30","date_gmt":"2022-01-18T11:05:30","guid":{"rendered":"https:\/\/blog.citrus-lime.com\/crmc\/?p=297"},"modified":"2022-01-18T11:05:31","modified_gmt":"2022-01-18T11:05:31","slug":"microsoft-team-for-each-key-account-using-conditional-rules-in-docdrive365","status":"publish","type":"post","link":"https:\/\/blog.citrus-lime.com\/crmc\/microsoft-team-for-each-key-account-using-conditional-rules-in-docdrive365\/","title":{"rendered":"Microsoft Team for each Key Account using Conditional Rules in DocDrive365"},"content":{"rendered":"\n<p>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.<\/p>\n\n\n\n<p>But what if we need to have branching logic for different types of record within the same Entity?<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>This guide will show how this can be configured.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Find our Entity<\/h4>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>This will usually have a number of rules looking like the following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_7D0402DF.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_2A8522A3.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<p>This will typically include a pair of Bucket and Record Rules defining a Document Library as the \u2018bucket\u2019 to place each new Folder for an Account Record.<\/p>\n\n\n\n<p>These rules will currently be non-conditional and so running for all Accounts &#8211; so our first time is to make these two conditional.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_183C5BE1.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_05F3951F.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Conditional Rules<\/h4>\n\n\n\n<p>We can open both our Rules and look at the list of Conditions for each Rule.<\/p>\n\n\n\n<p>For a Non-Conditional Rule, this will be blank.<\/p>\n\n\n\n<p>In Power Apps this is a Many-to-Many relationship between the Rule and the Condition &#8211; so we can attach an existing Condition we have already defined, or create a new Condition for our logic.<\/p>\n\n\n\n<p>We can start from scratch by creating a new Condition to only carry out this Rule if the [Relation Type] field is not \u2018Customer\u2019.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_73AACE5C.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_1A78E49D.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<p>With this condition created, we can attach to both the Bucket and Record Rules:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_08301DDB.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_330881ED.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<p>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.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Microsoft Team per Account<\/h4>\n\n\n\n<p>Now we can look at defining our alternate flow if the Account is a Customer.&nbsp; 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:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_20BFBB2B.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_236876DC.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<p>We then make this Conditional to define which Accounts should be represented by a Team in Microsoft Teams &#8211; in my case, a Condition that allow does this is [Relationship Type] is \u2018Customer\u2019:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_4E40DAEE.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_3BF8142C.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_62C62A6C.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_656EE61D.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<p>With this combination of Conditional Record and Bucket Rules our Entity Definition will look like:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_10474A30.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_7DFE836D.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Testing for a Non-Customer<\/h4>\n\n\n\n<p>We can then create new Account Records to test how this works for our Customers and Non-Customers.<\/p>\n\n\n\n<p>Starting with Non-Customers, we can track a new Account and review the Location created for us in SharePoint.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_6BB5BCAB.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_2B7FA331.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_1936DC6F.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_1BDF9820.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Testing for a Customer<\/h4>\n\n\n\n<p>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.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_42417B6B.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_2FF8B4A9.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<p>We can see the result in Microsoft Teams:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_6FC29B2E.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_2F8C81B4.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<p>Or by clicking Location to browse into SharePoint directly:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_4B310DAA.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_38E846E8.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Non Customer to Customer?<\/h4>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>If or when this happens, the logic in DocDrive will pick up on the change and adjust the Document Location automatically.<\/p>\n\n\n\n<p>So if test it an initially non-key account:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_269F8026.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_666966AB.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<p>This is reflected as a Folder in SharePoint.<\/p>\n\n\n\n<p>But on changing the Relationship Type, this promotes into a new Team:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_26334D31.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_65FD33B6.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<p>If need be, we can then demote back into a non-key account and go back to the Folder \u2013 this does not however automatically delete the Team (or any previous Location), just reversing the location that the Record in Dynamics is associated with.<\/p>\n\n\n\n<p>This swapping of locations as the Account changes which Conditions are met (and so which Record and Bucket Rules are applicable) \u2013 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.<\/p>\n\n\n\n<p>Correctly configured, for each New MS Team created will come with pre-installed with the DocDrive Teams App.<\/p>\n\n\n\n<p>This App allows for Posts and Updates to be posted from Dynamics into Teams \u2013 either as simple Messages or detailed Adaptive Cards.<\/p>\n\n\n\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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<\/p>\n","protected":false},"author":43,"featured_media":88,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_price":"","_stock":"","_tribe_ticket_header":"","_tribe_default_ticket_provider":"","_tribe_ticket_capacity":"0","_ticket_start_date":"","_ticket_end_date":"","_tribe_ticket_show_description":"","_tribe_ticket_show_not_going":false,"_tribe_ticket_use_global_stock":"","_tribe_ticket_global_stock_level":"","_global_stock_mode":"","_global_stock_cap":"","_tribe_rsvp_for_event":"","_tribe_ticket_going_count":"","_tribe_ticket_not_going_count":"","_tribe_tickets_list":"[]","_tribe_ticket_has_attendee_info_fields":false,"footnotes":""},"categories":[4],"tags":[],"class_list":{"0":"post-297","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-docdrive365"},"featured_image_src":"https:\/\/blog.citrus-lime.com\/crmc\/wp-content\/uploads\/sites\/30\/2021\/12\/DocDriveSiteimageclouds-scaled.jpg","author_info":{"display_name":"jadesmith","author_link":"https:\/\/blog.citrus-lime.com\/crmc\/author\/jadesmith\/"},"_links":{"self":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts\/297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/users\/43"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/comments?post=297"}],"version-history":[{"count":1,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts\/297\/revisions"}],"predecessor-version":[{"id":298,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts\/297\/revisions\/298"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/media\/88"}],"wp:attachment":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/media?parent=297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/categories?post=297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/tags?post=297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}