{"id":14028,"date":"2019-01-11T12:06:42","date_gmt":"2019-01-11T12:06:42","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=14028"},"modified":"2021-08-25T11:14:23","modified_gmt":"2021-08-25T11:14:23","slug":"retrieve-many-to-many-nn-related-records-in-dynamics-365-using-microsoft-flow","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2019\/01\/retrieve-many-to-many-nn-related-records-in-dynamics-365-using-microsoft-flow\/","title":{"rendered":"Retrieve Many-to-many (N:N) related records in Dynamics 365 using Microsoft Flow"},"content":{"rendered":"<h2>Introduction:<\/h2>\n<p style=\"text-align: justify;\">Microsoft Flow has definitely leveraged the capabilities of Dynamics 365 to a next level and with the long list of connectors, it provides seamless integration across various different digital ecosystems.<\/p>\n<p style=\"text-align: justify;\">In this blog we are going to discuss a workaround to retrieve records linked to each other via many to many relationship in Dynamics 365.<\/p>\n<p style=\"text-align: justify;\">Currently, flow provides the capability to retrieve records linked to each other via One to Many relationship by using expand property but when we used the expand property to retrieve records linked to each other via Many to Many relationship, it didn\u2019t provided the expected response. As a workaround we have to pull the records via a link entity (An intermediate entity that holds record of relationship between two different entities).<\/p>\n<p style=\"text-align: justify;\">For our reference we would take the example of Marketing list and Contact records as they are linked to each other via Many to Many (N:N) relationship. We would perform some operation on list related contact records.<\/p>\n<p>Following are the steps to achieve the above described objective:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-14029\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/01\/1Retrieve-Many-to-many-related-records-in-Dynamics-365-using-Microsoft-Flow.png\" alt=\"Retrieve Many to many related records in Dynamics 365 using Microsoft Flow\" width=\"822\" height=\"757\" \/><\/p>\n<p style=\"text-align: justify;\">In the above image you can see that we have used the link entity named \u201clistmembers\u201d which holds the link between contacts and marketing list, this listmembers entity is not available by default but you can access it by selecting Enter custom value from the Entity Name dropdown and then write it manually in the Entity Name text field.<\/p>\n<p style=\"text-align: justify;\">In order to filter the relevant records we have used a filter query that makes sure that only rows that contain link between the list and contact with the provided guid are retrieved and nothing else should be retrieved so we have used _listid_value eq &lt;guid&gt;.<\/p>\n<p style=\"text-align: justify;\">Once we get the list of link entity records then we will use an apply to each to retrieve contacts from Dynamics CRM one by one and we can perform any further operation after the retrieve contact records(list record step).<\/p>\n<ul>\n<li>Listmembers \u2013 It is the name of our link entity(may differ depending on your related entities)<\/li>\n<li>_listid_value \u2013 It represents listid of Marketing list in link entity record<\/li>\n<li>Entity(field name) \u2013 It represents contactid in link entity record<\/li>\n<\/ul>\n<p><strong><em>Note: <\/em><\/strong><em>The guid of the _list_value may differ as per your requirement. Also the unique identifier for the contactid is a parameter named Entity from the retrieved list which may also differ depending on the link entity.<\/em><\/p>\n<h2>Conclusion:<\/h2>\n<p style=\"text-align: justify;\">Using above steps user can retrieve records linked to each other via many to many relationship in Dynamics 365 using Microsoft Flow.<\/p>\n<h2 style=\"text-align: left;\"><div class=\"su-heading su-heading-style-default su-heading-align-center\" id=\"\" style=\"font-size:15px;margin-bottom:5px\"><div class=\"su-heading-inner\">Free 70% of storage space in CRM with Attachment Management Apps!<\/div><\/div><\/h2>\n<p><em><strong><a href=\"https:\/\/www.inogic.com\/product\/productivity-apps\/attach-2-dynamics-365-crm-upload-multiple-files-sharepoint-cloud-storage\" target=\"_blank\" rel=\"noopener noreferrer\">Attach2Dynamics<\/a> &#8211; Store and manage documents\/attachments in cloud storage of your choice &#8211; SharePoint, Dropbox or Azure Blob Storage from within Dynamics 365 CRM.<\/em><br \/>\n<em><strong><a href=\"https:\/\/www.inogic.com\/product\/productivity-apps\/dynamics-365-crm-sharepoint-security-metadata-sync\" target=\"_blank\" rel=\"noopener noreferrer\">SharePoint Security Sync<\/a><\/strong> \u2013 Robust and secure solution to integrate Dynamics 365 CRM and SharePoint Security Sync thereby ensuring secure access to confidential documents stored in SharePoint.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: Microsoft Flow has definitely leveraged the capabilities of Dynamics 365 to a next level and with the long list of connectors, it provides seamless integration across various different digital ecosystems. In this blog we are going to discuss a workaround to retrieve records linked to each other via many to many relationship in Dynamics\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2019\/01\/retrieve-many-to-many-nn-related-records-in-dynamics-365-using-microsoft-flow\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":14030,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[16,36,1985],"tags":[547,561],"class_list":["post-14028","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dynamics-365","category-microsoft-flow","category-power-automate","tag-dynamics-365-crm-microsoft-flow","tag-dynamics-365-microsoft-flow"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/14028","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=14028"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/14028\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/14030"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=14028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=14028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=14028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}