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 / Special characters in ...
Power Automate
Answered

Special characters in variable

(1) ShareShare
ReportReport
Posted on by 149

I have a requirement to copy some names from a SP list to another list.

The flow I have created works fine except when the names have an apostrophe.

 

As I am looping through the names, I won't be able to use the escape character logic.

OR will I?

 

Any idea on how to handle the names?

Categories:
I have the same question (0)
  • efialttes Profile Picture
    14,756 on at

    @rohinMVP 

    Can you share an screenshot from your flow definition and another one from the execution result with one of the names with apostrophe?

    Thanx!

  • rohinMVP Profile Picture
    149 on at

    @efialttesI won't be able to provide a screenshot.

     

    However, the error message is like this: The expression "Organization eq 'JOHN'S FOUNDATION'" is not valid.

     

    The filter query for my Get Items step is Organization eq 'OrganizationName'

  • Verified answer
    efialttes Profile Picture
    14,756 on at

    Thanx for the info!

    I found this topic covering -I guess- the same OData apostrophe related problem.

    https://powerusers.microsoft.com/t5/Building-Flows/Using-a-value-with-a-single-quote-as-an-Odata-filter-query/td-p/37043

    Hope this helps

     

  • Verified answer
    rohinMVP Profile Picture
    149 on at

    Thanks @efialttes .

     

    The link you provided helped me get my flow running.

     

    Now I have the below step to catch the apostrophes.

    replace(items('Apply_to_each')?['Department']?['Value'],'''','''''')

     

    I save the output to a variable, and use it in the below filter

    DepName eq '[DepartmenName]'

     

    However, if I insert the value in DepartmentName to my list, it will be saved with two quotes.

    like JOHN''S FOUNDATION.

     

    I had to get around this by doing a replace again:

    replace(variables('DepartmentName'),'''''','''')
  • efialttes Profile Picture
    14,756 on at

    @rohinMVP 

    Thanx for taking some extra time to document and share your workaround details!

    I have also marked it as a solution, since I'm sure it will help others in the future.

    You guys make this community great!

  • rw_ga Profile Picture
    137 on at

    I know this is a 3yr old topic, but I ran across a similar issue when trying to use data containing special characters in JSON format. The special characters caused JSON issues. While searching I ran across this post and another one where the solution seems to only require 2 actions. A select data operation action and compose data operation. The link where I found the solution is here: (26) Power Automate - An easy way to generate JSON objects without worrying about special characters | LinkedIn. Instead of using [0] in the compose I used first(). either way seems to work, but the select action appears to handle all the work of escaping the characters. So far so good!

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 921

#2
Valantis Profile Picture

Valantis 801

#3
Haque Profile Picture

Haque 588

Last 30 days Overall leaderboard