web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Escape Single Quote in...
Power Automate
Answered

Escape Single Quote in Attribute Value

(0) ShareShare
ReportReport
Posted on by 11

I have a flow that lists rows from a SQL table, then for each record determines if it should use Custom Data Service to update an entity in Dynamics.

 

Part of this flow is to List Records with CDS and with a Filter Query compare the city name from SQL with the city name attribute on the Entity.  The problem is when I try to do:  DeliriumTremens_0-1594228687698.png, which is a field from the SQL query, it will fail if the city name has a single quote in it.  What is the best way to tell Flow to escape single quotes in the attribute value AddressCity if they exist?  I'd like to avoid simply removing the character from city names if possible.

Categories:
I have the same question (0)
  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @DeliriumTremens 

    Please see this post as I believe it will provide you with a solution.

     

  • Verified answer
    DeliriumTremens Profile Picture
    11 on at

    Thanks for the reply Scott --

     

    The first solution in that post, which I had tried previously, involves adding a \ to escape the single quote, however when I do that the flow then attempts to escape the \ on its own, messing up the comparison 

    DeliriumTremens_0-1594234896117.png

    The second solution in that post was a nonstarter, and far more complicated than I felt it should be.

     

    After spending a questionable amount of time on it, the solution that eventually worked for me was to do replace(attribute,'''','''''') so that the Filter Query expression would successfully compare the two values.

     

    It would be nice if something like a single quote in a string would knowingly cause issues in a Filter Query expression, that Flow would know to escape it on its own instead of requiring the user to kludge a fix on their own.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 873

#2
Valantis Profile Picture

Valantis 822

#3
Haque Profile Picture

Haque 482

Last 30 days Overall leaderboard