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 / Double Quotes Within C...
Power Automate
Unanswered

Double Quotes Within Compose

(0) ShareShare
ReportReport
Posted on by 42

Hi,

 

I'm in a situation where I need to replace some html with a string that contains double quotes and this is throwing off the double quotes wrapping the compose (I think)

 

I am attempting the following function:

Quotes.PNG

 

Plain text version:

"@replace(outputs('Compose'), 'img', "img onerror=this.style.display = none"')"

 

It replaces the string 'img' with some onerror styling. I'd edit the HTML itself if I could but we aren't generating these emails so we have to correct for it here.

 

This line works perfectly if there are no double quotes within the surrounding quotes, like I have here. If I try something like this then the compose takes no action and it's output becomes "@replace(outputs('Compose'), 'img', 'img onerror=""')" (the compose itself)

 

Not sure if I am explaining this well but I'll be around to reply, thanks!!

Categories:
I have the same question (0)
  • v-yamao-msft Profile Picture
    Microsoft Employee on at

    Hi ChrisCC,


    From the Workflow definition language, we know that when using the replace function, a single quote is needed. While when I create a simple flow to test this issue, it seems that when the given string contains double quotes, the old string will not be replaced, the Compose takes no action and the outputs will become the compose itself.

    I assume that this might be a default behavior when using Workflow definition language. Please remove the double quotes within the function to see if it will meet your needs.


    Best regards,
    Mabel Mao

  • ChrisCC Profile Picture
    42 on at

    Unfortunately the replacement text contains necessary double quotes itself so I can't remove them

  • chandbhu Profile Picture
    Microsoft Employee on at

    Hi,

     

    You will need to escape the double quotes in the expression. Please delete existing compose2 action and create a new compose action, and enter following for the input.  (Editing existing compose action may not work as it's already in bad state)

     

    "@replace('outputs('Compose')', 'img', 'img onerror=\"this.style.display = none\"')"

     

    Thanks

    Chandra

     

     

  • Wendy_Lumsden Profile Picture
    58 on at

    Hi @ChrisCC ,

     

    Did you resolve the issue?  I am having the same problem where I need the result of a concat to include text which as double quotes (the concat is being used in an xml query).

     

    However, the concat expression always adds a backslash before the double quotation marks.   .... and using replace to remove the backslash from the result of the concat is not working either.

     

    Any assistance would be greatly appreciated.

    Many thanks

    Wendy

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!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 304

#2
David_MA Profile Picture

David_MA 245 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 243 Most Valuable Professional

Last 30 days Overall leaderboard