cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Hxrrisxn
Level: Powered On

Replace expression not working

Hi,

I am trying to create a document from a HTML file. I am doing this by suing the replace expression. The Flow pulls data from a SharePoint List and uses the Replace expression to populate fields. My first expression that pulls down the HTML file works however the second does not despite being practically the same expression. Please see below:

 

Working expression - replace(outputs('Get_file_content_-_HTML')?['body'],'{title}',outputs('Get_item_-_TI_DB')?['body/Title'])

 

Failing expression - replace(outputs('Get_file_content_-_HTML')?['body'],'{Risk Rating}',outputs('Get_item_-_TI_DB')?['body/Risk Rating'])

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Replace expression not working

Hi @Hxrrisxn 

If you are confident that the value in Risk Rating is a string value you can force the expression to treat it as a string by changing it to the following.

replace(outputs('Get_file_content_-_HTML')?['body'],'{Risk Rating}',string(outputs('Get_item_-_TI_DB')?['body/Risk Rating']))

 


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

Proud to be a Flownaut!


Follow me on Twitter at @QG_LeeJHarris

Or on LinkedIn at in/leejharris

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Replace expression not working

Hi @Hxrrisxn 

Are you receiving any error messages when this Flow runs and reaches your failing expression? If so, please share the error as this may help with diagnosing the issue.

 


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

Proud to be a Flownaut!


Follow me on Twitter at @QG_LeeJHarris

Or on LinkedIn at in/leejharris

Hxrrisxn
Level: Powered On

Re: Replace expression not working

Hi Lee,

 

Please see below.

InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '1' and column '14469': 'The template language function 'replace' expects its third parameter 'new string' to be a string. The provided value is of type 'Object'. Please see https://aka.ms/logicexpressions#replace for usage details.'.

 

 

Super User
Super User

Re: Replace expression not working

Hi @Hxrrisxn 

If you are confident that the value in Risk Rating is a string value you can force the expression to treat it as a string by changing it to the following.

replace(outputs('Get_file_content_-_HTML')?['body'],'{Risk Rating}',string(outputs('Get_item_-_TI_DB')?['body/Risk Rating']))

 


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

Proud to be a Flownaut!


Follow me on Twitter at @QG_LeeJHarris

Or on LinkedIn at in/leejharris

View solution in original post

Hxrrisxn
Level: Powered On

Re: Replace expression not working

Hi Lee,

 

This allows the Flow to work. However i am trying to get the section replace to pull data from my first compose function. 

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (4,834)