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 / Power Automate error -...
Power Automate
Suggested Answer

Power Automate error - 'null' values

(1) ShareShare
ReportReport
Posted on by 23
Hello.
 
I am receiving the following errors regarding some workflows:
 
"One or more fields provided is of type 'Null', a different type is expected."
 
"InvalidTemplate. Unable to process template language expressions in action 'Send_an_email_notification_(V3)_2' inputs at line '0' and column '0': 'The template language function 'replace' expects its first parameter 'string' to be a string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#replace for usage details.'."
 
I am seeking assistance with how to fix these errors. I am thinking a 'replace' function should work if the field's value is 'null'. I found the following expression online: if(equals(<VALUE TO TEST>, null), 'Value if null', 'Value if not null')
 
If the value is 'null', I would like it to be replaced with a space (if not possible, a period or dash will work). If it is not 'null' I want the field to execute another 'replace' function, so plain text can have line breaks. For the line breaks, I am using this expression and it is working so far on its own when the field is not 'null': replace(triggerOutputs()?['body/SMComments'],outputs('NewLine'),'</br>')
 
When I try to combine the expressions, Power Automate says the expression is invalid. May some assist me with trying to combine these expressions into one or provide an alternative that would have the same result I am looking for? This is the invalid expression I have been attempting: if(equals(triggerOutputs()?['body/SMComments'], null), -, replace(triggerOutputs()?['body/SMComments'],outputs('NewLine'),'</br>'))
 
Any help would be greatly appreciated!
 
Categories:
I have the same question (0)
  • JJP1 Profile Picture
    23 on at
    Figured it out... It had to do with formatting. 
     
    The following expression works and resulted in successful testing:
     
    if(equals(triggerOutputs()?['body/SMComments'],null),'',replace(triggerOutputs()?['body/SMComments'],outputs('NewLine'),'</br>'))
     
    Null values are replaced with a blank space. 
  • eliphalet Profile Picture
    4 on at
    Instead of testing a string as equal to null, you can use the empty([string]) function, which returns a true or false value.
  • Suggested answer
    chanzy Profile Picture
    2 on at
    Another way to account for this is to use the string function around the variable you are testing. Using your example:
     
     replace(string(triggerOutputs()?['body/SMComments']),outputs('NewLine'),'</br>')
  • AbacusBob Profile Picture
    2 on at
    I'm really a beginner and it appears that I'm in well over my head...
     
    1) I'm glad you discovered a solution...  and it looks great but where do you insert this expression... in the get response?
     
    So far it's not doing anything but stalling the flow. 
     
    so I'm going to just get rid of everything that I've put in.. the parts of the flow that are working, are apparently working enuf to get me what I need...   but I need this fixed somehow...
     
    Here's an assumption:   
    if(equals(triggerOutputs()?['body/field name here '],null),'',replace(triggerOutputs()?['body/field name here '],outputs('NewLine'),'</br>'))
     
     
    so where do i put this, I've got a "when a new response is submitted", a "get response details" and a "Send and email(v2)"
     
    Im thinking it's gotta go in the "get response details", as that will be before the error in "send and email)v2)"  so where does it go?? 

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 557

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 264 Super User 2026 Season 1

Last 30 days Overall leaderboard