{"id":40999,"date":"2025-04-23T15:20:44","date_gmt":"2025-04-23T09:50:44","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=40999"},"modified":"2025-04-23T15:22:39","modified_gmt":"2025-04-23T09:52:39","slug":"how-to-capture-user-questions-asked-to-copilot-in-dynamics-365-crm-using-power-automate","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2025\/04\/how-to-capture-user-questions-asked-to-copilot-in-dynamics-365-crm-using-power-automate\/","title":{"rendered":"How to capture user questions asked to Copilot in Dynamics 365 CRM using Power Automate"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41019\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/Power-Automate-1.png\" alt=\"Power Automate\" width=\"1400\" height=\"800\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/Power-Automate-1.png 1400w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/Power-Automate-1-300x171.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/Power-Automate-1-1024x585.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/Power-Automate-1-768x439.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/Power-Automate-1-660x377.png 660w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><\/p>\n<p>As Microsoft\u2019s Copilot becomes an integral part of the Dynamics 365 CRM ecosystem, understanding how users interact with it has become essential for businesses aiming to enhance their digital customer experience. Recently, a client approached us with a unique requirement \u2013 they wanted to capture the user details like username, Business Unit, Timestamp, and the exact question they typed when interacting with Copilot within their D365 CRM environment.<\/p>\n<p>In this blog, we\u2019ll walk you through how I approached this scenario and built a Power Automate flow with an Action &amp; Plugin that captures these interactions effectively.<\/p>\n<h4><strong>Step 1: Create or Open Your Solution<\/strong><\/h4>\n<p>Begin by creating a solution in <a href=\"https:\/\/make.powerapps.com\/\">Power Apps<\/a>, or open the solution you created earlier organized and easy to manage within the Dynamics 365 environment.<\/p>\n<p>Step 2: Create an Automated Cloud Flow<\/p>\n<ul>\n<li>Navigate to New &gt; Automation &gt; Cloud flow &gt; Automated<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41000\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/1Copilot-in-Dynamics-365-CRM-using-Power-Automate.png\" alt=\"Copilot in Dynamics 365 CRM using Power Automate\" width=\"1379\" height=\"704\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/1Copilot-in-Dynamics-365-CRM-using-Power-Automate.png 1379w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/1Copilot-in-Dynamics-365-CRM-using-Power-Automate-300x153.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/1Copilot-in-Dynamics-365-CRM-using-Power-Automate-1024x523.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/1Copilot-in-Dynamics-365-CRM-using-Power-Automate-768x392.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/1Copilot-in-Dynamics-365-CRM-using-Power-Automate-660x337.png 660w\" sizes=\"(max-width: 1379px) 100vw, 1379px\" \/><\/p>\n<p><strong>Step 3: Configure Trigger<\/strong><\/p>\n<ul>\n<li>Flow name: Copilot Interaction<\/li>\n<li>Choose the trigger: When a row is added, modified, or deleted (Microsoft Dataverse).<\/li>\n<li>Click Create<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41001\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/2Copilot-in-Dynamics-365-CRM-using-Power-Automate.png\" alt=\"Copilot in Dynamics 365 CRM using Power Automate\" width=\"1379\" height=\"604\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/2Copilot-in-Dynamics-365-CRM-using-Power-Automate.png 1379w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/2Copilot-in-Dynamics-365-CRM-using-Power-Automate-300x131.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/2Copilot-in-Dynamics-365-CRM-using-Power-Automate-1024x449.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/2Copilot-in-Dynamics-365-CRM-using-Power-Automate-768x336.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/2Copilot-in-Dynamics-365-CRM-using-Power-Automate-660x289.png 660w\" sizes=\"(max-width: 1379px) 100vw, 1379px\" \/><\/p>\n<p><strong>Step 4: Trigger and Initialize<\/strong><\/p>\n<p>I used the &#8220;Copilot Interaction&#8221; table to trigger the flow and then fetched the related transcript data using the dataid.<\/p>\n<p><strong>1. Trigger<\/strong>:<\/p>\n<ul>\n<li>Action: When a row is added<\/li>\n<li>Table: Copilot Interactions<\/li>\n<li>Scope: Organization<\/li>\n<\/ul>\n<p><strong>2. Initialize Variable<\/strong>: (Store the Question Ask By User)<\/p>\n<ul>\n<li>Name: Questions<\/li>\n<li>Type: Array<\/li>\n<li>Value: [] (empty array)<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41002\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/3Copilot-in-Dynamics-365-CRM-using-Power-Automate.png\" alt=\"Copilot in Dynamics 365 CRM using Power Automate\" width=\"1379\" height=\"574\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/3Copilot-in-Dynamics-365-CRM-using-Power-Automate.png 1379w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/3Copilot-in-Dynamics-365-CRM-using-Power-Automate-300x125.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/3Copilot-in-Dynamics-365-CRM-using-Power-Automate-1024x426.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/3Copilot-in-Dynamics-365-CRM-using-Power-Automate-768x320.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/3Copilot-in-Dynamics-365-CRM-using-Power-Automate-660x275.png 660w\" sizes=\"(max-width: 1379px) 100vw, 1379px\" \/><\/p>\n<h4><strong>Step 5: Parse Interaction Context and Validate<\/strong><\/h4>\n<p>After capturing the interaction, we parse the msdyn_interactioncontext using a Compose action to access the full JSON object. From this, we extract the Transcript.DataId to use later for fetching the related transcript.<\/p>\n<p>Then, we use a Condition block to validate whether the interaction context is valid and contains data.<\/p>\n<p>Expressions used:<\/p>\n<p><strong>1. To check if the interaction context is not empty:<\/strong><\/p>\n<p>outputs(&#8216;Interaction_Context&#8217;) is not equal to json(&#8216;{}&#8217;)<\/p>\n<p><strong>2. To extract the Transcript.DataId from the interaction context:<\/strong><\/p>\n<p>outputs(&#8216;Interaction_Context&#8217;)?[&#8216;Transcript&#8217;]?[&#8216;DataId&#8217;]\n<p>These expressions make sure the context is valid and allow us to move forward only if the DataId exists, preventing flow failures or unnecessary steps.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41003\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/4Copilot-in-Dynamics-365-CRM-using-Power-Automate.png\" alt=\"Copilot in Dynamics 365 CRM using Power Automate\" width=\"1379\" height=\"559\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/4Copilot-in-Dynamics-365-CRM-using-Power-Automate.png 1379w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/4Copilot-in-Dynamics-365-CRM-using-Power-Automate-300x122.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/4Copilot-in-Dynamics-365-CRM-using-Power-Automate-1024x415.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/4Copilot-in-Dynamics-365-CRM-using-Power-Automate-768x311.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/4Copilot-in-Dynamics-365-CRM-using-Power-Automate-660x268.png 660w\" sizes=\"(max-width: 1379px) 100vw, 1379px\" \/><\/p>\n<h4><strong>Step 6: Get User Details from Transcript Record<\/strong><\/h4>\n<p>Once we have the Transcript.DataId, we use the Get a row by ID &#8211; Copilot Transcript Datas action to retrieve detailed information about the interaction from the Dataverse table.<\/p>\n<p>Then, we extract and format the following fields using Compose actions:<\/p>\n<p><strong>1. Created By (User Name)<\/strong><br \/>\nTo get the formatted user name who initiated the Copilot interaction:<\/p>\n<p>outputs(&#8216;Get_a_row_by_ID_-_Copilot_Transcript_Datas&#8217;)?[&#8216;body\/_createdby_value@OData.Community.Display.V1.FormattedValue&#8217;]\n<p><strong>2. Business Unit<\/strong><br \/>\nTo determine which business unit the user belongs to:<\/p>\n<p>outputs(&#8216;Get_a_row_by_ID_-_Copilot_Transcript_Datas&#8217;)?[&#8216;body\/_owningbusinessunit_value@OData.Community.Display.V1.FormattedValue&#8217;]\n<p><strong>3. Timestamp (Last Modified)<\/strong><br \/>\nThis gives us the last modified time of the interaction record, representing the time of the chat:<\/p>\n<p>outputs(&#8216;Get_a_row_by_ID_-_Copilot_Transcript_Datas&#8217;)?[&#8216;body\/modifiedon@OData.Community.Display.V1.FormattedValue&#8217;]\n<p>These expressions help extract clean, readable values for display or reporting purposes<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41004\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/5Copilot-in-Dynamics-365-CRM-using-Power-Automate.png\" alt=\"Copilot in Dynamics 365 CRM using Power Automate\" width=\"1379\" height=\"638\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/5Copilot-in-Dynamics-365-CRM-using-Power-Automate.png 1379w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/5Copilot-in-Dynamics-365-CRM-using-Power-Automate-300x139.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/5Copilot-in-Dynamics-365-CRM-using-Power-Automate-1024x474.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/5Copilot-in-Dynamics-365-CRM-using-Power-Automate-768x355.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/5Copilot-in-Dynamics-365-CRM-using-Power-Automate-660x305.png 660w\" sizes=\"(max-width: 1379px) 100vw, 1379px\" \/><\/p>\n<h4><strong>Step 7: Decode and Convert Transcript Data to JSON<\/strong><\/h4>\n<p>Once we have the Transcript Data (which is stored in Base64 UTF-16LE format), we need to decode it properly to extract readable JSON data.<\/p>\n<p><strong>\u00a0Steps:<\/strong><\/p>\n<p><strong>1. Download a Transcript Data File<\/strong><\/p>\n<ul>\n<li>Use the action: <strong>Download a file or an image<\/strong><\/li>\n<li><strong>Table Name:<\/strong> Copilot Transcript Datas<\/li>\n<li><strong>Row ID:<\/strong>outputs(&#8216;DataId&#8217;)<\/li>\n<li><strong>Column Name:<\/strong> Transcript Data<br \/>\nThis downloads the actual transcript as a file in Base64 encoded format.<\/li>\n<\/ul>\n<p><strong>2. Convert to Base64 String<\/strong><\/p>\n<ul>\n<li>Add a <strong>Compose<\/strong> action:\n<ul>\n<li>base64(body(&#8216;Download_a_Transcript_Data_File&#8217;))<\/li>\n<\/ul>\n<\/li>\n<li>This converts the binary file content into a base64 string (still in UTF-16LE format).<\/li>\n<\/ul>\n<p><strong>3. Why decoding directly doesn&#8217;t work<\/strong><br \/>\nThe data is in UTF-16 Little Endian (UTF-16LE) format. Standard base64ToString() or decodeUriComponent() methods don&#8217;t work properly here.<br \/>\n\u27a4So we need to use a Dataverse plugin to handle the decoding correctly.<\/p>\n<p><strong>4. Perform Unbound Action (Call Action &amp; Plugin)<\/strong><\/p>\n<ul>\n<li>Action: cop_ConvertBase64UTF16ToUTF8<\/li>\n<li>Input:outputs(&#8216;base64string&#8217;)<\/li>\n<li>This plugin safely converts your Base64 UTF-16LE string into UTF-8 readable format.<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41005\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/6Copilot-in-Dynamics-365-CRM-using-Power-Automate.png\" alt=\"Copilot in Dynamics 365 CRM using Power Automate\" width=\"1379\" height=\"627\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/6Copilot-in-Dynamics-365-CRM-using-Power-Automate.png 1379w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/6Copilot-in-Dynamics-365-CRM-using-Power-Automate-300x136.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/6Copilot-in-Dynamics-365-CRM-using-Power-Automate-1024x466.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/6Copilot-in-Dynamics-365-CRM-using-Power-Automate-768x349.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/6Copilot-in-Dynamics-365-CRM-using-Power-Automate-660x300.png 660w\" sizes=\"(max-width: 1379px) 100vw, 1379px\" \/><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41006\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/7Copilot-in-Dynamics-365-CRM-using-Power-Automate.png\" alt=\"Copilot in Dynamics 365 CRM using Power Automate\" width=\"1379\" height=\"629\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/7Copilot-in-Dynamics-365-CRM-using-Power-Automate.png 1379w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/7Copilot-in-Dynamics-365-CRM-using-Power-Automate-300x137.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/7Copilot-in-Dynamics-365-CRM-using-Power-Automate-1024x467.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/7Copilot-in-Dynamics-365-CRM-using-Power-Automate-768x350.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/7Copilot-in-Dynamics-365-CRM-using-Power-Automate-660x301.png 660w\" sizes=\"(max-width: 1379px) 100vw, 1379px\" \/><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41007\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/8Copilot-in-Dynamics-365-CRM-using-Power-Automate.png\" alt=\"Copilot in Dynamics 365 CRM using Power Automate\" width=\"1908\" height=\"830\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/8Copilot-in-Dynamics-365-CRM-using-Power-Automate.png 1908w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/8Copilot-in-Dynamics-365-CRM-using-Power-Automate-300x131.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/8Copilot-in-Dynamics-365-CRM-using-Power-Automate-1024x445.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/8Copilot-in-Dynamics-365-CRM-using-Power-Automate-768x334.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/8Copilot-in-Dynamics-365-CRM-using-Power-Automate-1536x668.png 1536w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/8Copilot-in-Dynamics-365-CRM-using-Power-Automate-660x287.png 660w\" sizes=\"(max-width: 1908px) 100vw, 1908px\" \/><\/p>\n<p><strong>5. Develop a Plugin<\/strong><\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\n<li>Code:<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<pre class=\"lang:css gutter:true start:1\">using System;\r\nusing Microsoft.Xrm.Sdk;\r\n\r\nusing System.Text;\r\n\r\n\u00a0\r\n\r\nnamespace DecodeBase64String\r\n\r\n{\r\n\r\npublic class DecodeBase64 : IPlugin\r\n\r\n{\r\n\r\npublic void Execute(IServiceProvider serviceProvider)\r\n\r\n{\r\n\r\n\/\/ Declare variables outside the try block\r\n\r\nIPluginExecutionContext context = null;\r\n\r\nIOrganizationServiceFactory serviceFactory = null;\r\n\r\nIOrganizationService service = null;\r\n\r\nITracingService tracingService = null;\r\n\r\n\u00a0\r\n\r\nstring inputParameterName = \"Base64Input\";\r\n\r\nstring outputParameterName = \"ConvertedUTF8\";\r\n\r\nstring base64String = string.Empty;\r\n\r\nbyte[] utf16Bytes = null;\r\n\r\nbyte[] utf8Bytes = null;\r\n\r\nstring utf8String = string.Empty;\r\n\r\nEncoding utf16Encoding = Encoding.Unicode; \/\/ UTF-16LE\r\n\r\nEncoding utf8Encoding = Encoding.UTF8;\r\n\r\n\r\ntry\r\n\r\n{\r\n\r\n\/\/ Get services\r\n\r\ncontext = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));\r\n\r\nserviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));\r\n\r\nservice = serviceFactory.CreateOrganizationService(context.UserId);\r\n\r\ntracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));\r\n\r\n\r\n\/\/ Check input parameter\r\n\r\nif (!context.InputParameters.ContainsKey(inputParameterName) || context.InputParameters[inputParameterName] == null)\r\n\r\n{\r\n\r\nthrow new InvalidPluginExecutionException($\"Input parameter '{inputParameterName}' not found or is null.\");\r\n\r\n}\r\n\u00a0\r\n\r\n\/\/ Get Base64 string\r\n\r\nbase64String = context.InputParameters[inputParameterName] as string;\r\n\u00a0\r\n\r\nif (string.IsNullOrEmpty(base64String))\r\n\r\n{\r\n\r\ntracingService.Trace(\"Base64 string is empty.\");\r\n\r\ncontext.OutputParameters[outputParameterName] = string.Empty;\r\n\r\nreturn;\r\n\r\n}\r\n\r\ntracingService.Trace($\"Base64 String: {base64String}\");\r\n\r\n\/\/ Decode from Base64 to UTF-16LE bytes\r\n\r\nutf16Bytes = Convert.FromBase64String(base64String);\r\n\r\n\/\/ Convert UTF-16LE bytes to UTF-8 bytes\r\n\r\nutf8Bytes = Encoding.Convert(utf16Encoding, utf8Encoding, utf16Bytes);\u00a0\r\n\r\n\/\/ Convert bytes to UTF-8 string\r\n\r\nutf8String = utf8Encoding.GetString(utf8Bytes);\r\n\r\ntracingService.Trace($\"UTF-8 String: {utf8String}\");\r\n\r\n\/\/ Set output\r\n\r\ncontext.OutputParameters[outputParameterName] = utf8String;\r\n\r\ntracingService.Trace($\"Output parameter '{outputParameterName}' set with UTF-8 string.\");\r\n\r\n}\r\n\r\ncatch (Exception ex)\r\n\r\n{\r\n\r\nif (tracingService != null)\r\n\r\n{\r\n\r\ntracingService.Trace($\"Error: {ex.Message}\");\r\n\r\n}\r\n\u00a0\r\nthrow new InvalidPluginExecutionException($\"An error occurred in DecodeBase64 plugin: {ex.Message}\", ex);\r\n\r\n}\r\n\r\n}\r\n\r\n}\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<ol start=\"6\">\n<li><strong>Parse into JSON<\/strong><\/li>\n<\/ol>\n<p>1. Add another <strong>Compose<\/strong> action:<\/p>\n<p>json(outputs(&#8216;Perform_an_unbound_action&#8217;)?[&#8216;body\/DecodedData&#8217;])<\/p>\n<p>2. Now your data is clean, structured, and ready to be used as JSON in your Power Automate flow.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41008\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/9Copilot-in-Dynamics-365-CRM-using-Power-Automate.png\" alt=\"Copilot in Dynamics 365 CRM using Power Automate\" width=\"1379\" height=\"628\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/9Copilot-in-Dynamics-365-CRM-using-Power-Automate.png 1379w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/9Copilot-in-Dynamics-365-CRM-using-Power-Automate-300x137.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/9Copilot-in-Dynamics-365-CRM-using-Power-Automate-1024x466.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/9Copilot-in-Dynamics-365-CRM-using-Power-Automate-768x350.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/9Copilot-in-Dynamics-365-CRM-using-Power-Automate-660x301.png 660w\" sizes=\"(max-width: 1379px) 100vw, 1379px\" \/><\/p>\n<p><strong>Note:<\/strong><br \/>\nYou could use third-party websites available online, but most are either paid or less secure. This plugin-based method is 100% free, secure, and directly integrated with Dataverse<\/p>\n<h3><strong>Understanding the Data Flow<\/strong><\/h3>\n<p>Each interaction with Copilot is stored in the Copilot Transcript Datas table.<\/p>\n<ul>\n<li>It contains a Transcript Data column (file type).<\/li>\n<li>This file holds the full JSON (questions, other info, etc.).<\/li>\n<li>If the user refreshes the chat window, a new record is created.<\/li>\n<li>If the user stays in the same session, questions keep appending to the <strong>same record<\/strong>.<\/li>\n<\/ul>\n<h4><strong>Step 8: Parse the JSON to Extract User Messages<\/strong><\/h4>\n<p>After decoding the base64 content, we now parse the JSON structure to access individual messages.<\/p>\n<p><strong>Action: Parse JSON<\/strong><\/p>\n<ul>\n<li><strong>Content<\/strong>:<br \/>\noutputs(&#8216;Convert_DecodedData_into_Json&#8217;)<\/li>\n<li><strong>Schema<\/strong>:<\/li>\n<\/ul>\n<pre class=\"lang:css gutter:true start:1\">{\r\n\r\n\"type\": \"object\",\r\n\r\n\"properties\": {\r\n\r\n\"messages\": {\r\n\r\n\"type\": \"array\",\r\n\r\n\"items\": {\r\n\r\n\"type\": \"object\",\r\n\r\n\"properties\": {\r\n\r\n\"user\": {\r\n\r\n\"type\": \"string\"\r\n\r\n},\r\n\r\n\"message\": {\r\n\r\n\"type\": \"string\"\r\n\r\n}\r\n\r\n},\r\n\r\n\"required\": [\"user\", \"message\"]\r\n\r\n}\r\n\r\n}\r\n\r\n}\r\n\r\n}<\/pre>\n<p><strong>Apply to Each: Loop Through Messages<\/strong><\/p>\n<ul>\n<li><strong>Input<\/strong>:<br \/>\nbody(&#8216;Parse_JSON&#8217;)?[&#8216;messages&#8217;]<\/li>\n<\/ul>\n<p>This iterates over every message within the parsed JSON array.<\/p>\n<h4><strong>Condition: Check if the Message Was Typed by the User<\/strong><\/h4>\n<ul>\n<li><strong>Expression<\/strong>:<br \/>\nitems(&#8216;Apply_to_each&#8217;)?[&#8216;user&#8217;] is equal to \u2192 &#8220;user&#8221;<\/li>\n<\/ul>\n<p>This ensures you&#8217;re only extracting the questions typed by the user (not by Copilot or bot).<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41009\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/10Copilot-in-Dynamics-365-CRM-using-Power-Automate.png\" alt=\"Copilot in Dynamics 365 CRM using Power Automate\" width=\"1379\" height=\"623\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/10Copilot-in-Dynamics-365-CRM-using-Power-Automate.png 1379w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/10Copilot-in-Dynamics-365-CRM-using-Power-Automate-300x136.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/10Copilot-in-Dynamics-365-CRM-using-Power-Automate-1024x463.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/10Copilot-in-Dynamics-365-CRM-using-Power-Automate-768x347.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/10Copilot-in-Dynamics-365-CRM-using-Power-Automate-660x298.png 660w\" sizes=\"(max-width: 1379px) 100vw, 1379px\" \/><\/p>\n<h4><strong>Step 9: Store and Display the User Questions<\/strong><\/h4>\n<p>Once we\u2019ve confirmed the message is from the <strong>user<\/strong>, we now want to store these questions and make them available for further processing or display.<\/p>\n<p><strong>\u00a0Append <\/strong><strong>Question <\/strong><strong>to Array Variable<\/strong><\/p>\n<ul>\n<li><strong>Action<\/strong>: Append to array variable<\/li>\n<li><strong>Name<\/strong>: Questions<\/li>\n<li><strong>Value<\/strong>:<br \/>\nmessage (this holds the actual question typed by the user)<\/li>\n<\/ul>\n<p><strong>Action: Compose (to get all questions as a single string)<\/strong><\/p>\n<p>This combines all user questions with line breaks:<\/p>\n<p><strong>join(variables(&#8216;Questions&#8217;), decodeUriComponent(&#8216;%0A&#8217;))<\/strong><\/p>\n<p><strong>Action: Compose (to get the latest question and timestamp)<\/strong><\/p>\n<p>To show only the most recent question along with its timestamp:<\/p>\n<p><strong>last(variables(&#8216;Questions&#8217;)) &#8211; @{outputs(&#8216;Timestamp&#8217;)}<\/strong><\/p>\n<p>This is especially helpful if you&#8217;re showing real-time Q&amp;A or logging the latest query.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41010\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/11Copilot-in-Dynamics-365-CRM-using-Power-Automate.png\" alt=\"Copilot in Dynamics 365 CRM using Power Automate\" width=\"1379\" height=\"618\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/11Copilot-in-Dynamics-365-CRM-using-Power-Automate.png 1379w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/11Copilot-in-Dynamics-365-CRM-using-Power-Automate-300x134.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/11Copilot-in-Dynamics-365-CRM-using-Power-Automate-1024x459.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/11Copilot-in-Dynamics-365-CRM-using-Power-Automate-768x344.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/11Copilot-in-Dynamics-365-CRM-using-Power-Automate-660x296.png 660w\" sizes=\"(max-width: 1379px) 100vw, 1379px\" \/><\/p>\n<h4><strong>Step 10: Chat with Copilot ( To Check the Flow Output )<\/strong><\/h4>\n<p>Ask your question in Copilot (e.g., <em>&#8220;Can u give details of mobile heating issue?&#8221;<\/em>).<br \/>\nGo to Power Automate \u2192 My Flows \u2192 Check the latest run to see the question with the timestamp in the output.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41011\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/12Copilot-in-Dynamics-365-CRM-using-Power-Automate.png\" alt=\"Copilot in Dynamics 365 CRM using Power Automate\" width=\"1375\" height=\"500\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/12Copilot-in-Dynamics-365-CRM-using-Power-Automate.png 1375w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/12Copilot-in-Dynamics-365-CRM-using-Power-Automate-300x109.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/12Copilot-in-Dynamics-365-CRM-using-Power-Automate-1024x372.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/12Copilot-in-Dynamics-365-CRM-using-Power-Automate-768x279.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/12Copilot-in-Dynamics-365-CRM-using-Power-Automate-660x240.png 660w\" sizes=\"(max-width: 1375px) 100vw, 1375px\" \/><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41012\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/13Copilot-in-Dynamics-365-CRM-using-Power-Automate.png\" alt=\"Copilot in Dynamics 365 CRM using Power Automate\" width=\"1379\" height=\"627\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/13Copilot-in-Dynamics-365-CRM-using-Power-Automate.png 1379w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/13Copilot-in-Dynamics-365-CRM-using-Power-Automate-300x136.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/13Copilot-in-Dynamics-365-CRM-using-Power-Automate-1024x466.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/13Copilot-in-Dynamics-365-CRM-using-Power-Automate-768x349.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/04\/13Copilot-in-Dynamics-365-CRM-using-Power-Automate-660x300.png 660w\" sizes=\"(max-width: 1379px) 100vw, 1379px\" \/><\/p>\n<h3><strong>Conclusion<\/strong><\/h3>\n<p>In this blog, we used Power Automate to build a flow that captures user questions via Copilot and stores them with a timestamp. We used actions like Compose to handle and display the data clearly. This setup helps automate data collection for further processing or integration with other systems.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As Microsoft\u2019s Copilot becomes an integral part of the Dynamics 365 CRM ecosystem, understanding how users interact with it has become essential for businesses aiming to enhance their digital customer experience. Recently, a client approached us with a unique requirement \u2013 they wanted to capture the user details like username, Business Unit, Timestamp, and the\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2025\/04\/how-to-capture-user-questions-asked-to-copilot-in-dynamics-365-crm-using-power-automate\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":15,"featured_media":0,"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":[2746,16,1985,2361],"tags":[2705,1975],"class_list":["post-40999","post","type-post","status-publish","format-standard","hentry","category-copilot","category-dynamics-365","category-power-automate","category-technical","tag-copilot","tag-power-automate"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/40999","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\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=40999"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/40999\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=40999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=40999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=40999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}