{"id":11946,"date":"2018-06-11T15:16:36","date_gmt":"2018-06-11T09:46:36","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=11946"},"modified":"2019-07-10T09:30:40","modified_gmt":"2019-07-10T09:30:40","slug":"integrating-dynamics-365-with-azure-functions-part-2","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/","title":{"rendered":"Integrating Dynamics 365 with Azure Functions &#8211; Part 2"},"content":{"rendered":"<p><img decoding=\"async\" class=\"aligncenter wp-image-11964\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Copy-of-Clone-Multiple-Quotes-or-Invoices-in-Dynamics-365-CRM-in-a-One-Click.png\" alt=\"Integrating D365 with Azure Functions\" width=\"825\" height=\"471\" \/><\/p>\n<p><strong>Introduction:<\/strong><\/p>\n<p>In our\u00a0<a title=\"Integrating Dynamics 365 with Azure Functions\" href=\"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions\/\" target=\"_blank\" rel=\"noopener noreferrer\">recent\u00a0<\/a>blog, We saw how to create an Azure function and now that we have our Azure function ready and hosted, let\u2019s look at invoking the function through a workflow. At this point, we will execute the function through an HTTP request instead of registering the function as a Webhook.<\/p>\n<p>Let us modify the code from our previous <a href=\"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions\/\" target=\"_blank\" rel=\"noopener noreferrer\">blog<\/a> to connect to a SQL database and return a record. We will then use the data returned from SQL to create a record in CRM.<\/p>\n<p>Since VS Code does not provide intellisense,\u00a0we will write the code in VS and then copy it to VS Code \u2013 Is there a better way to do this?<\/p>\n<p>In VS,\u00a0we have the following function ready<\/p>\n<pre class=\"lang:default decode:true \">using Newtonsoft.Json;\r\nusing Newtonsoft.Json.Linq;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Data;\r\nusing System.Data.SqlClient;\r\nusing System.Dynamic;\r\n static ExpandoObject ReadData(string id)\r\n        {\r\n            DataSet ds = null;\r\n            dynamic obj = null;\r\n            try\r\n            {\r\n                \/\/connection string\r\n                string connectionString = \"Server=xxx.database.windows.net,1433;Initial Catalog=SampleSQL;Persist Security Info=False;User ID=xx;Password=xx;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;\";\r\n\r\n                \/\/ado connection object\r\n                SqlConnection con = new SqlConnection(connectionString);\r\n\r\n                \/\/query customer\r\n                string query = \"select * from [SalesLT].[Customer] where CustomerID = \" + id;\r\n\r\n                \/\/create adapter\r\n                SqlDataAdapter adapter = new SqlDataAdapter(query, con);\r\n\r\n                \/\/execute query\r\n                adapter.Fill(ds);\r\n\r\n                \/\/Check if record found\r\n                if (ds!= null &amp;&amp; ds.Tables.Count &gt;0 &amp;&amp; ds.Tables[0].Rows.Count &gt; 0)\r\n                {\r\n                    DataRow dr = ds.Tables[0].Rows[0];\r\n\r\n                    obj = new ExpandoObject();\r\n                    obj.Fname = dr[\"FirstName\"].ToString();\r\n                    obj.Lname = dr[\"LastName\"].ToString();\r\n                    obj.Email = dr[\"EmailAddress\"].ToString();\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n\r\n                throw new Exception(ex.Message);\r\n            }\r\n\r\n            return obj;\r\n        }\r\n<\/pre>\n<p>We will copy this function to VS Code and save. You will find the following errors reported for missing references.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-11948\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Integrating-D365-with-Azure-Functions-II.png\" alt=\"Integrating D365 with Azure Functions\" width=\"817\" height=\"151\" \/><\/p>\n<p>To reference assemblies in .csx we need to add the following lines in the run.csx<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-11950\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Integrating-D365-with-Azure-Functions-II-11.jpg\" alt=\"Integrating D365 with Azure Functions\" width=\"827\" height=\"169\" \/><\/p>\n<p>Create a bin folder and copy Newtonsoft dll there so that it is referenced correctly here.<\/p>\n<p>Next, replace the code to use full qualified type names \u201cSystem.Data.DataRow\u201d<\/p>\n<p>Let us call this function from the main function and pass the data received in the name querystring to the function to look up the record from SQL<\/p>\n<pre class=\"lang:default decode:true \">public static async Task&lt;HttpResponseMessage&gt; Run(HttpRequestMessage req, TraceWriter log)\r\n{\r\n    log.Info(\"C# HTTP trigger function processed a request.\");\r\n\r\n    \/\/ parse query parameter\r\n    string name = req.GetQueryNameValuePairs()\r\n        .FirstOrDefault(q =&gt; string.Compare(q.Key, \"name\", true) == 0)\r\n        .Value;\r\n\r\n    if (name == null)\r\n    {\r\n        \/\/ Get request body\r\n        dynamic data = await req.Content.ReadAsAsync&lt;object&gt;();\r\n        name = data?.name;\r\n    }\r\n\r\n\/\/call function to retrieve data from Azure SQL\r\n    dynamic obj = ReadData(name);\r\n\r\n    \/\/convert result to json string to be returned\r\n    string resp = Newtonsoft.Json.JsonConvert.SerializeObject(obj);\r\n    \r\n    return req.CreateResponse(HttpStatusCode.OK, resp);\r\n    \/\/ return name == null\r\n    \/\/     ? req.CreateResponse(HttpStatusCode.BadRequest, \"Please pass a name on the query string or in the request body\")\r\n    \/\/     : req.CreateResponse(HttpStatusCode.OK, \"Hello \" + name);\r\n}<\/pre>\n<p>Once it compiles fine, upload the code to Azure and test it.<\/p>\n<p>Execution from Postman will now show the following result<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-11953\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Integrating-D365-with-Azure-Functions-II-4.png\" alt=\"Integrating D365 with Azure Functions\" width=\"454\" height=\"215\" \/><\/p>\n<p>Let us now call this from a workflow assembly<\/p>\n<p>The following code snippet would invoke the azure function using HTTP POST request.<\/p>\n<blockquote><p>Note: We are accepting Function URL and secret as a workflow parameter<\/p><\/blockquote>\n<pre class=\"lang:default decode:true\">\/\/read url\r\n                string url = executionContext.GetValue(AzureFunctionURL);\r\n\r\n                \/\/read secret\r\n                string secret = executionContext.GetValue(AuthCode);\r\n\r\n                \/\/ TODO: Implement your custom Workflow business logic.\r\n                tracingService.Trace(\"Before calling azure function\");\r\n\r\n                \/\/Uri FuncURL = new Uri(url);\r\n                UriBuilder uriBuilder = new UriBuilder(url);\r\n                uriBuilder.Query = \"code=\" + secret;\r\n\r\n                tracingService.Trace(\"Azure URL: \" + uriBuilder.Uri.ToString());\r\n\r\n                string result = Post2Azure(uriBuilder,tracingService,service).Result;\r\n\r\nprivate static async Task&lt;string&gt; Post2Azure(UriBuilder uriBuilder, ITracingService tracingService, IOrganizationService service)\r\n        {\r\n            string result = string.Empty;\r\n                \/\/create http client object\r\n                HttpClient client = new HttpClient();\r\n\r\n                \/\/data to send\r\n                var data = \"{\\\"name\\\": \\\"5\\\"}\";\r\n\r\n                \/\/send in byte format\r\n                var buffer = System.Text.Encoding.UTF8.GetBytes(data);\r\n                var byteContent = new ByteArrayContent(buffer);\r\n                byteContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(\"application\/json\");\r\n\r\n                tracingService.Trace(\"send request\");\r\n                \/\/execute request\r\n                HttpResponseMessage response = client.PostAsync(uriBuilder.Uri, byteContent).Result;\r\n\r\n                if (response == null)\r\n                {\r\n                    tracingService.Trace(\"no response received\");\r\n                    throw new InvalidOperationException(\"Failed to obtain the httpResponse\");\r\n                }\r\n\r\n\r\n                result = await response.Content.ReadAsStringAsync();\r\n\r\n                tracingService.Trace(\"response read: \" + result);\r\n\r\n                \/\/remove extra \\\r\n                result = result.Replace(@\"\\\", \"\");\r\n                \/\/remove the start double quote\r\n                result = result.Remove(0, 1);\r\n                \/\/remove ending double quote\r\n                result = result = result.Remove(result.Length - 1, 1);\r\n\r\n                JObject ob = JObject.Parse(result);\r\n\r\n                tracingService.Trace(\"responseparsed to json: \");\r\n\r\n                \/\/Create a CRM contact\r\n                Entity contact = new Entity(\"contact\");\r\n                contact[\"firstname\"] = ob[\"Fname\"].ToString();\r\n\r\n                tracingService.Trace(\"firsname to json: \" + ob[\"Fname\"].ToString());\r\n\r\n                contact[\"lastname\"] = ob[\"Lname\"].ToString();\r\n\r\n                tracingService.Trace(\"firsname to json: \" + ob[\"Lname\"].ToString());\r\n\r\n                contact[\"emailaddress1\"] = ob[\"Email\"].ToString();\r\n                Guid id = service.Create(contact);\r\n                tracingService.Trace(\"contact created \" + id.ToString());\r\n\r\n            }\r\n<\/pre>\n<p>Register the workflow assembly and execute the workflow. It would read from Azure SQL and create a contact in CRM<\/p>\n<p>In the next step, we would register the Azure function as a Webhook.<\/p>\n<p><strong>Conclusion:<\/strong><\/p>\n<p>Using the simple steps above the user can register the workflow assembly and execute the workflow. In our <a href=\"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-3\/\" target=\"_blank\" rel=\"noopener noreferrer\">next blog<\/a> will see how to register the Azure function as a webhook\u00a0and register steps for messages that you would like the custom logic to be executed for.<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/product\/productivity-pack\/click-2-clone-microsoft-dynamics-crm-records\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-10690\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2016\/01\/Copy-System-and-Custom-Entities-in-Dynamics-CRM.png\" alt=\"Copy System and Custom Entities in Dynamics CRM\" width=\"820\" height=\"205\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: In our\u00a0recent\u00a0blog, We saw how to create an Azure function and now that we have our Azure function ready and hosted, let\u2019s look at invoking the function through a workflow. At this point, we will execute the function through an HTTP request instead of registering the function as a Webhook. Let us modify the\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/\">Read More: Integrating Dynamics 365 with Azure Functions &#8211; Part 2 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":11956,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,18,19],"tags":[187,188],"class_list":["post-11946","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure-functions","category-dynamics-365-v9-2","category-dynamics-crm","tag-azure-functions","tag-azure-functions-dynamics-365"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"Introduction: In our recent blog, We saw how to create an Azure function and now that we have our Azure function ready and hosted, let\u2019s look at invoking the function through a workflow. At this point, we will execute the function through an HTTP request instead of registering the function as a Webhook. Let us modify the\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Inogic\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Microsoft Dynamics 365 CRM Tips and Tricks - By Inogic\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Integrating Dynamics 365 with Azure Functions \u2013 Part 2 - Microsoft Dynamics 365 CRM Tips and Tricks\" \/>\n\t\t<meta property=\"og:description\" content=\"Introduction: In our recent blog, We saw how to create an Azure function and now that we have our Azure function ready and hosted, let\u2019s look at invoking the function through a workflow. At this point, we will execute the function through an HTTP request instead of registering the function as a Webhook. Let us modify the\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Copy-of-Clone-Multiple-Quotes-or-Invoices-in-Dynamics-365-CRM-in-a-One-Click.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Copy-of-Clone-Multiple-Quotes-or-Invoices-in-Dynamics-365-CRM-in-a-One-Click.png\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2018-06-11T09:46:36+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-07-10T09:30:40+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inogicindia\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@inogic\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Integrating Dynamics 365 with Azure Functions \u2013 Part 2 - Microsoft Dynamics 365 CRM Tips and Tricks\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Introduction: In our recent blog, We saw how to create an Azure function and now that we have our Azure function ready and hosted, let\u2019s look at invoking the function through a workflow. At this point, we will execute the function through an HTTP request instead of registering the function as a Webhook. Let us modify the\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@inogic\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Copy-of-Clone-Multiple-Quotes-or-Invoices-in-Dynamics-365-CRM-in-a-One-Click.png\" \/>\n\t\t<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t\t<meta name=\"twitter:data1\" content=\"Inogic\" \/>\n\t\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2018\\\/06\\\/integrating-dynamics-365-with-azure-functions-part-2\\\/#blogposting\",\"name\":\"Integrating Dynamics 365 with Azure Functions \\u2013 Part 2 - Microsoft Dynamics 365 CRM Tips and Tricks\",\"headline\":\"Integrating Dynamics 365 with Azure Functions &#8211; Part 2\",\"author\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/inogic-2\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/06\\\/Copy-of-Blog-Feature-Images-150-_150-42-1-1.png\",\"width\":150,\"height\":150},\"datePublished\":\"2018-06-11T15:16:36+05:30\",\"dateModified\":\"2019-07-10T09:30:40+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2018\\\/06\\\/integrating-dynamics-365-with-azure-functions-part-2\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2018\\\/06\\\/integrating-dynamics-365-with-azure-functions-part-2\\\/#webpage\"},\"articleSection\":\"Azure Functions, Dynamics 365 v9, Dynamics CRM, Azure Functions, Azure Functions Dynamics 365\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2018\\\/06\\\/integrating-dynamics-365-with-azure-functions-part-2\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.inogic.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/azure-functions\\\/#listItem\",\"name\":\"Azure Functions\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/azure-functions\\\/#listItem\",\"position\":2,\"name\":\"Azure Functions\",\"item\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/azure-functions\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2018\\\/06\\\/integrating-dynamics-365-with-azure-functions-part-2\\\/#listItem\",\"name\":\"Integrating Dynamics 365 with Azure Functions &#8211; Part 2\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2018\\\/06\\\/integrating-dynamics-365-with-azure-functions-part-2\\\/#listItem\",\"position\":3,\"name\":\"Integrating Dynamics 365 with Azure Functions &#8211; Part 2\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/azure-functions\\\/#listItem\",\"name\":\"Azure Functions\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#organization\",\"name\":\"Microsoft Dynamics 365 CRM Tips and Tricks\",\"description\":\"By Inogic\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/inogic-logo.png\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2018\\\/06\\\/integrating-dynamics-365-with-azure-functions-part-2\\\/#organizationLogo\",\"width\":1000,\"height\":325,\"caption\":\"inogic logo\"},\"image\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2018\\\/06\\\/integrating-dynamics-365-with-azure-functions-part-2\\\/#organizationLogo\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/inogicindia\",\"https:\\\/\\\/twitter.com\\\/inogic\",\"https:\\\/\\\/www.instagram.com\\\/inogicindia\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCM4V7ousgLSu1hbOEv4DUuQ\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/inogicindia\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/inogic-2\\\/#author\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/inogic-2\\\/\",\"name\":\"Inogic\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2018\\\/06\\\/integrating-dynamics-365-with-azure-functions-part-2\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/839d9ae7d2b941d2d09e91df322267a429821f2ce5494302b53bd5ca3679f1a0?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Inogic\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2018\\\/06\\\/integrating-dynamics-365-with-azure-functions-part-2\\\/#webpage\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2018\\\/06\\\/integrating-dynamics-365-with-azure-functions-part-2\\\/\",\"name\":\"Integrating Dynamics 365 with Azure Functions \\u2013 Part 2 - Microsoft Dynamics 365 CRM Tips and Tricks\",\"description\":\"Introduction: In our recent blog, We saw how to create an Azure function and now that we have our Azure function ready and hosted, let\\u2019s look at invoking the function through a workflow. At this point, we will execute the function through an HTTP request instead of registering the function as a Webhook. Let us modify the\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2018\\\/06\\\/integrating-dynamics-365-with-azure-functions-part-2\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/inogic-2\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/inogic-2\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/06\\\/Copy-of-Blog-Feature-Images-150-_150-42-1-1.png\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2018\\\/06\\\/integrating-dynamics-365-with-azure-functions-part-2\\\/#mainImage\",\"width\":150,\"height\":150},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2018\\\/06\\\/integrating-dynamics-365-with-azure-functions-part-2\\\/#mainImage\"},\"datePublished\":\"2018-06-11T15:16:36+05:30\",\"dateModified\":\"2019-07-10T09:30:40+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/\",\"name\":\"Microsoft Dynamics 365 CRM Tips and Tricks\",\"alternateName\":\"Inogic\",\"description\":\"By Inogic\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Integrating Dynamics 365 with Azure Functions \u2013 Part 2 - Microsoft Dynamics 365 CRM Tips and Tricks","description":"Introduction: In our recent blog, We saw how to create an Azure function and now that we have our Azure function ready and hosted, let\u2019s look at invoking the function through a workflow. At this point, we will execute the function through an HTTP request instead of registering the function as a Webhook. Let us modify the","canonical_url":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/#blogposting","name":"Integrating Dynamics 365 with Azure Functions \u2013 Part 2 - Microsoft Dynamics 365 CRM Tips and Tricks","headline":"Integrating Dynamics 365 with Azure Functions &#8211; Part 2","author":{"@id":"https:\/\/www.inogic.com\/blog\/author\/inogic-2\/#author"},"publisher":{"@id":"https:\/\/www.inogic.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Copy-of-Blog-Feature-Images-150-_150-42-1-1.png","width":150,"height":150},"datePublished":"2018-06-11T15:16:36+05:30","dateModified":"2019-07-10T09:30:40+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/#webpage"},"isPartOf":{"@id":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/#webpage"},"articleSection":"Azure Functions, Dynamics 365 v9, Dynamics CRM, Azure Functions, Azure Functions Dynamics 365"},{"@type":"BreadcrumbList","@id":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.inogic.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/category\/azure-functions\/#listItem","name":"Azure Functions"}},{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/category\/azure-functions\/#listItem","position":2,"name":"Azure Functions","item":"https:\/\/www.inogic.com\/blog\/category\/azure-functions\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/#listItem","name":"Integrating Dynamics 365 with Azure Functions &#8211; Part 2"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/#listItem","position":3,"name":"Integrating Dynamics 365 with Azure Functions &#8211; Part 2","previousItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/category\/azure-functions\/#listItem","name":"Azure Functions"}}]},{"@type":"Organization","@id":"https:\/\/www.inogic.com\/blog\/#organization","name":"Microsoft Dynamics 365 CRM Tips and Tricks","description":"By Inogic","url":"https:\/\/www.inogic.com\/blog\/","logo":{"@type":"ImageObject","url":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2023\/02\/inogic-logo.png","@id":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/#organizationLogo","width":1000,"height":325,"caption":"inogic logo"},"image":{"@id":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/#organizationLogo"},"sameAs":["https:\/\/www.facebook.com\/inogicindia","https:\/\/twitter.com\/inogic","https:\/\/www.instagram.com\/inogicindia\/","https:\/\/www.youtube.com\/channel\/UCM4V7ousgLSu1hbOEv4DUuQ","https:\/\/www.linkedin.com\/company\/inogicindia"]},{"@type":"Person","@id":"https:\/\/www.inogic.com\/blog\/author\/inogic-2\/#author","url":"https:\/\/www.inogic.com\/blog\/author\/inogic-2\/","name":"Inogic","image":{"@type":"ImageObject","@id":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/839d9ae7d2b941d2d09e91df322267a429821f2ce5494302b53bd5ca3679f1a0?s=96&d=mm&r=g","width":96,"height":96,"caption":"Inogic"}},{"@type":"WebPage","@id":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/#webpage","url":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/","name":"Integrating Dynamics 365 with Azure Functions \u2013 Part 2 - Microsoft Dynamics 365 CRM Tips and Tricks","description":"Introduction: In our recent blog, We saw how to create an Azure function and now that we have our Azure function ready and hosted, let\u2019s look at invoking the function through a workflow. At this point, we will execute the function through an HTTP request instead of registering the function as a Webhook. Let us modify the","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.inogic.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/#breadcrumblist"},"author":{"@id":"https:\/\/www.inogic.com\/blog\/author\/inogic-2\/#author"},"creator":{"@id":"https:\/\/www.inogic.com\/blog\/author\/inogic-2\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Copy-of-Blog-Feature-Images-150-_150-42-1-1.png","@id":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/#mainImage","width":150,"height":150},"primaryImageOfPage":{"@id":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/#mainImage"},"datePublished":"2018-06-11T15:16:36+05:30","dateModified":"2019-07-10T09:30:40+05:30"},{"@type":"WebSite","@id":"https:\/\/www.inogic.com\/blog\/#website","url":"https:\/\/www.inogic.com\/blog\/","name":"Microsoft Dynamics 365 CRM Tips and Tricks","alternateName":"Inogic","description":"By Inogic","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.inogic.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Microsoft Dynamics 365 CRM Tips and Tricks - By Inogic","og:type":"article","og:title":"Integrating Dynamics 365 with Azure Functions \u2013 Part 2 - Microsoft Dynamics 365 CRM Tips and Tricks","og:description":"Introduction: In our recent blog, We saw how to create an Azure function and now that we have our Azure function ready and hosted, let\u2019s look at invoking the function through a workflow. At this point, we will execute the function through an HTTP request instead of registering the function as a Webhook. Let us modify the","og:url":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/","og:image":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Copy-of-Clone-Multiple-Quotes-or-Invoices-in-Dynamics-365-CRM-in-a-One-Click.png","og:image:secure_url":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Copy-of-Clone-Multiple-Quotes-or-Invoices-in-Dynamics-365-CRM-in-a-One-Click.png","article:published_time":"2018-06-11T09:46:36+00:00","article:modified_time":"2019-07-10T09:30:40+00:00","article:publisher":"https:\/\/www.facebook.com\/inogicindia","twitter:card":"summary_large_image","twitter:site":"@inogic","twitter:title":"Integrating Dynamics 365 with Azure Functions \u2013 Part 2 - Microsoft Dynamics 365 CRM Tips and Tricks","twitter:description":"Introduction: In our recent blog, We saw how to create an Azure function and now that we have our Azure function ready and hosted, let\u2019s look at invoking the function through a workflow. At this point, we will execute the function through an HTTP request instead of registering the function as a Webhook. Let us modify the","twitter:creator":"@inogic","twitter:image":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Copy-of-Clone-Multiple-Quotes-or-Invoices-in-Dynamics-365-CRM-in-a-One-Click.png","twitter:label1":"Written by","twitter:data1":"Inogic","twitter:label2":"Est. reading time","twitter:data2":"4 minutes"},"aioseo_meta_data":{"post_id":"11946","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2023-02-02 06:52:34","updated":"2025-07-04 04:29:49","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.inogic.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.inogic.com\/blog\/category\/azure-functions\/\" title=\"Azure Functions\">Azure Functions<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tIntegrating Dynamics 365 with Azure Functions \u2013 Part 2\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.inogic.com\/blog"},{"label":"Azure Functions","link":"https:\/\/www.inogic.com\/blog\/category\/azure-functions\/"},{"label":"Integrating Dynamics 365 with Azure Functions &#8211; Part 2","link":"https:\/\/www.inogic.com\/blog\/2018\/06\/integrating-dynamics-365-with-azure-functions-part-2\/"}],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/11946","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=11946"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/11946\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/11956"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=11946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=11946"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=11946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}