Showing results for 
Search instead for 
Did you mean: 
New Member

'The template language function 'replace' expects its first parameter 'string' to be a string. The provided value is of type 'Null'.

Our company migrated to a new tenant and in doing so, all of our flows broke.


The following 'replace' functions worked until now and I cannot figure out how to fix them:


  • replace(replace(replace(replace(triggerBody()?['Subject'],' ','_'),'#','_'),'+','_'),',','_')
  • replace(triggerBody()?['DateTimeReceived'],' ','_')


The error I'm receiving is in the subject line. Please help?

Super User III
Super User III

The trigger isn't sending any data for the replace to work with. Take a look at the trigger output in the run history. Perhaps you have moved to a new tenant but you haven't updated the flows appropriately?

Thank you for the suggestion. I am so far outside of my wheelhouse here. I've looked at the trigger output in the run history and am coming up short on where the issue is.


The flow we have takes an e-mail that comes into a shared mailbox, exports it and creates a file in Sharepoint - that's where this is failing. Once the file is created in Sharepoint it inserts a row into a Smartsheet.


If I take all of the replace logic out then the e-mails are mostly blank for subject, sender, etc. when I open them.

Super User III
Super User III

I feel like a broken record, but check the run history, it's the best way to figure out what has gone wrong. Check it at every stage, right from the trigger action. Copy the outputs and put them into something like notepad++ so you can clearly see them. You should be able to see the properties of your inbound email there and that will lead you down the path of doing some meaningful troubleshooting.

Again - I appreciate your help - I have checked the outputs. I'm only looking to replace characters from the e-mail subject and the date/time received - and neither of those fields are null in any of the trigger outputs that I'm looking at.

Solution Supplier
Solution Supplier

@lorynhope the error is saying you have a null value. Is the replace expression inside an Apply to Each loop? if it is, one of the subject must be null. In the history, click on next failed.

Helpful resources

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.


Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (3,635)