{"id":19714,"date":"2019-07-18T10:54:26","date_gmt":"2019-07-18T10:54:26","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=19714"},"modified":"2022-02-15T16:45:37","modified_gmt":"2022-02-15T11:15:37","slug":"replace-single-quote-from-attribute-in-microsoft-flow","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2019\/07\/replace-single-quote-from-attribute-in-microsoft-flow\/","title":{"rendered":"How to replace Single Quote from attribute in Microsoft Flow"},"content":{"rendered":"<h2><strong>Introduction<\/strong><\/h2>\n<p>In one of our <a href=\"https:\/\/www.inogic.com\/blog\/2019\/05\/update-existing-records-in-dynamics-365-crm-using-microsoft-flow\/?fbclid=IwAR2IH7upVIqhCj2DdaksrSuF1Pg_R1DcXhqlt_tEB-cB9yBn7fw1jGXD0Ow\" target=\"_blank\" rel=\"noopener noreferrer\">blog<\/a>s we have seen how to update existing records in CDS (Common Data Service) using Microsoft flow in Dynamics 365 CRM.<\/p>\n<p>But recently we came across a scenario where we wanted to update a Contact record based on First name, Last name &amp; EmailAddress using Microsoft Flow.<\/p>\n<p>However, while retrieving the list of Lead records we faced an error 400. This error was caused because there was special character like Single Quote (\u2019) in the Last name.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-19715\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/1Replace-Single-Quote-from-attribute-in-Microsoft-Flow.png\" alt=\"Replace Single Quote from attribute in Microsoft Flow\" width=\"682\" height=\"477\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/1Replace-Single-Quote-from-attribute-in-Microsoft-Flow.png 661w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/1Replace-Single-Quote-from-attribute-in-Microsoft-Flow-300x210.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/1Replace-Single-Quote-from-attribute-in-Microsoft-Flow-660x461.png 660w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/1Replace-Single-Quote-from-attribute-in-Microsoft-Flow-200x140.png 200w\" sizes=\"(max-width: 682px) 100vw, 682px\" \/><\/p>\n<p style=\"text-align: justify;\">So to overcome this issue we replaced the single quote while retrieving the contact records. In order to achieve this, we have to write a query to replace a single quote from the attribute. We will store this query in the variable and use the variable to retrieve entity records.<\/p>\n<p><strong>Please follow the below steps to add a variable:<\/strong><\/p>\n<p style=\"text-align: justify;\"><strong>1<\/strong>. Before retrieving the lead record we have to add a step to initialize variable. For that add an Action and in the action search for Variables as shown in the given image.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-19716\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/2Replace-Single-Quote-from-attribute-in-Microsoft-Flow.png\" alt=\"Replace Single Quote from attribute in Microsoft Flow\" width=\"677\" height=\"430\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/2Replace-Single-Quote-from-attribute-in-Microsoft-Flow.png 648w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/2Replace-Single-Quote-from-attribute-in-Microsoft-Flow-300x190.png 300w\" sizes=\"(max-width: 677px) 100vw, 677px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\"><strong>2<\/strong>. After selecting <strong>Initialize variable<\/strong> in the name attribute you can give a name to your variable and in String type select type as a <strong>\u2018String\u2019. <\/strong><\/p>\n<p style=\"text-align: justify;\"><strong>3<\/strong>. In the value we have to write our expression to replace the Single quote from the received attribute in the body. Next, we will store the value in this created String variable. In our scenario we are removing single Quote from LastName attribute. You can find the below query to replace the single Quote from the attribute.<\/p>\n<p>Query = replace(triggerBody()?[&#8216;text_1&#8217;],&#8221;&#8221;,&#8221;&#8221;&#8221;)<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-19717\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/3Replace-Single-Quote-from-attribute-in-Microsoft-Flow.png\" alt=\"Replace Single Quote from attribute in Microsoft Flow\" width=\"670\" height=\"338\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/3Replace-Single-Quote-from-attribute-in-Microsoft-Flow.png 646w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/3Replace-Single-Quote-from-attribute-in-Microsoft-Flow-300x151.png 300w\" sizes=\"(max-width: 670px) 100vw, 670px\" \/><\/p>\n<p><strong>4<\/strong>. Finally, we can use this variable in our retrieve Filter Query as shown below.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-19718\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/4Replace-Single-Quote-from-attribute-in-Microsoft-Flow.png\" alt=\"Replace Single Quote from attribute in Microsoft Flow\" width=\"852\" height=\"324\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/4Replace-Single-Quote-from-attribute-in-Microsoft-Flow.png 852w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/4Replace-Single-Quote-from-attribute-in-Microsoft-Flow-300x114.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/4Replace-Single-Quote-from-attribute-in-Microsoft-Flow-768x292.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/4Replace-Single-Quote-from-attribute-in-Microsoft-Flow-660x251.png 660w\" sizes=\"(max-width: 852px) 100vw, 852px\" \/><\/p>\n<p><strong>5<\/strong>. As shown in below image you can see the successful run history record to retrieve the contact record.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-19719\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/5Replace-Single-Quote-from-attribute-in-Microsoft-Flow.png\" alt=\"Replace Single Quote from attribute in Microsoft Flow\" width=\"717\" height=\"397\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/5Replace-Single-Quote-from-attribute-in-Microsoft-Flow.png 692w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/5Replace-Single-Quote-from-attribute-in-Microsoft-Flow-300x166.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/07\/5Replace-Single-Quote-from-attribute-in-Microsoft-Flow-660x364.png 660w\" sizes=\"(max-width: 717px) 100vw, 717px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>Thus by using this approach we can successfully retrieve the record from Dynamics CRM and perform the operation on records.<\/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\"><a href=\"https:\/\/www.inogic.com\/product\/productivity-apps\/mailchimp-dynamics-365-crm-integration-marketing-4-dynamics\" target=\"_blank\" rel=\"noopener\">Marketing4Dynamics<\/a> \u2013 Mailchimp and Dynamics 365 CRM integration to plan effective sales strategies, increase sales and improve ROI<\/div><\/div><\/h2>\n<ul>\n<li>Sync Audiences, Members and Tags from Mailchimp to CRM<\/li>\n<li>Sync CRM Marketing List (Contacts\/Leads) to Mailchimp<\/li>\n<li>Sync Campaigns and Member activities from Mailchimp to CRM<\/li>\n<li>Monitor and analyze Mailchimp campaign statistics through Dashboards in CRM<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In one of our blogs we have seen how to update existing records in CDS (Common Data Service) using Microsoft flow in Dynamics 365 CRM. But recently we came across a scenario where we wanted to update a Contact record based on First name, Last name &amp; EmailAddress using Microsoft Flow. However, while retrieving\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2019\/07\/replace-single-quote-from-attribute-in-microsoft-flow\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":19720,"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":[36,1985],"tags":[1150],"class_list":["post-19714","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-flow","category-power-automate","tag-microsoft-flow"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/19714","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=19714"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/19714\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/19720"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=19714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=19714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=19714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}