cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
drako
Resolver I
Resolver I

HELP: When adding a \n in a compose action string and then adding it to POST Body adds additional \\

Hi,

   I'm sending a POST with HTTP.   before sending the POST I generated a Compose to add some New Lines. The odd thing here is that if I add the text directly in the Body of the POST it works but in the result of the compose it doesn't. Not sure why.  Let me show you:

 

  1. In this screen shot you can see the body has two \n \n in the text. This works perfect when it is written directly in the body.  It creates 2 next lines (carriage returns) in the comment. In this case for ASANA we are integrating. 
    • drako_1-1644954034312.png

       

  2. The second Compose Output has the following text once executed:  This is a Test of HTML test \n This is the next line. \n<b>This is bold</b> \n
  3. When I check the body of the POST (executed, runtime) the \n that were in the output have changed to \\n. 
    • {
        "data": {
          "html_text""<body> This Comment was generated in DevOps by: <b>  John Doe </b>  \n \n  This is a Test of HTML test \\n This is the next line. \\n <b>This is bold</b> \\n </body>"
        }
      }
  4. The result in the comment is this in ASANA
    • drako_2-1644954634495.png

       

  5. You can see that the \n that were added directly in the body of HTTP POST generated the 2 lines but the ones that were "injected" by the compose output were past a plain text as for some reason another "\" was added.

  I have spend a few days on this and tried many options without success. 

Help is appreciated. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User
Super User

Hi @drako 

 

Try the following:

 

image.png

 

Expression I used above is 

replace(outputs('Compose'),'\n',decodeUriComponent('%0D%0A'))
 
My test result:
 
image.png


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

2 REPLIES 2
abm
Super User
Super User

Hi @drako 

 

Try the following:

 

image.png

 

Expression I used above is 

replace(outputs('Compose'),'\n',decodeUriComponent('%0D%0A'))
 
My test result:
 
image.png


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

@abm  IT WORKED!!!!  Thanks a LOT!!!

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,217)