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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Apostrophe issue in fi...
Power Automate
Unanswered

Apostrophe issue in filter query

(0) ShareShare
ReportReport
Posted on by 319

Hi ,

 

I have a small issue with an apostrophe in email address which causes failure to run the filter query set on Get items. 

Prathameshpatka_0-1632986060753.png

 

 

can anyone suggest the best way to get this working ?

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @Prathameshpatka,

     

    Try escaping it with another apostrophe character.

     

    To give you an example

    Title eq 'Testing 'Test' - won't work

    Title eq 'Testing ''Test' - should work

  • Prathameshpatka Profile Picture
    319 on at

    @Expiscornovus 

     

    Can I use a replace expression to replace the single apostrophe with a double apostrophe as the email address is as a variable in the filter query as below . If so how can I get that done ?

     

    Prathameshpatka_1-1632987423494.png

     

    Prathameshpatka_3-1632987519735.png

     

     

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @Prathameshpatka,

     

    Yes, that would be an option. You also have to escape the apostrophe characters in that expression as well, so you end up with something like this 😁

     

    replace(variables('varA1Email'), '''', '''''')
  • Prathameshpatka Profile Picture
    319 on at

    Hi @Expiscornovus 

     

    I am trying to do the below by initializing two variables as below :

     

    Prathameshpatka_0-1632988850255.png

    can I then use a replace expression like this : 

    replace(variables('varA1Email'),variables('varApos'), variables('varApos2')) in the compose action to then set the variable varA1Emai to it's output or as you said to escape apostrophe characters I need to tweak the expression ??
  • Verified answer
    Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @Prathameshpatka,

     

    The approach with three variables should also work. 

     

    And you could use the expression also directly in the filter query field

     

    expression_filterqueryfield.png

  • Paulie78 Profile Picture
    8,422 Moderator on at

    I think it would be cleaner not to use any variables, but instead use something like this:

    replace(variables('varA1Email'), decodeUriComponent('%27'), decodeUriComponent('%27%27'))

    Which will replace a single apostrophe with two without the need for creating variables.

     

    Blog: tachytelic.net

    YouTube: https://www.youtube.com/c/PaulieM/videos

    If I answered your question, please accept it as a solution 😘

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Yes, that was my first response too. Only I used a lot of quote characters 😁

     

    replace(variables('varA1Email'), '''', '''''')

     

    That decodeUriComponent function is useful! 

  • ms-mac Profile Picture
    Microsoft Employee on at

    I tried the above on a List Rows function for Dataverse. It came back empty with a 200 result. 

    I succeeded by replacing the apostrophe with a blank (eg, removing the apostrophe); then I got the function to list actual records instead of a 200.

    replace(variables('varApostropheText'),decodeUriComponent('%27'), '')

     

  • ms-mac Profile Picture
    Microsoft Employee on at

    UPDATE: It worked when the record I was after did not include an apostrophe. It fails when the record does contain one. So, is there a way to get this to work for any variable? Whether or not it has an apostrophe?

  • ms-mac Profile Picture
    Microsoft Employee on at

    Disregard. Coder error (sigh)

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard