cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

Escape Single Quote in Attribute Value

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Advocate I
Advocate I

Re: Escape Single Quote in Attribute Value

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.

 

View solution in original post

2 REPLIES 2
Highlighted
Super User III
Super User III

Re: Escape Single Quote in Attribute Value

@DeliriumTremens 

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

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Highlighted
Advocate I
Advocate I

Re: Escape Single Quote in Attribute Value

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.

 

View solution in original post

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (6,089)