Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

The template function 'IfError' is not defined or not valid.'.

Like (1) ShareShare
ReportReport
Posted on 12 Jul 2024 12:17:15 by 18

I'm trying to use the IfError function:

Error, IfError, IsError, and IsBlankOrError functions - Power Platform | Microsoft Learn

It's quite unclear to me what I should enable since I don't see anything related:

federicoeulu_0-1720786571214.png

I cannot find that feature in Power Automate. I could only find it in my Power App that contains my Flow. Should I do something to enable it? Thanks.

  • federico-eu-lu Profile Picture
    18 on 12 Jul 2024 at 13:49:02
    Re: The template function 'IfError' is not defined or not valid.'.

    For the coalesce, I'm not sure if I used it well:

    federicoeulu_0-1720792019588.png

    But I still got a similar error, I am sending a 0?, but it's considered as a null?:

    federicoeulu_1-1720792077903.png

     

    So probably, what I'm doing is wrong?:

    coalesce(null, variables('Apps')?[items('Apply_to_each_4')?['centsys_name']], 0)
    Any idea?
  • federico-eu-lu Profile Picture
    18 on 12 Jul 2024 at 13:30:52
    Re: The template function 'IfError' is not defined or not valid.'.

    Perhaps, I'm using the empty function wrong, but this is what I did:

    federicoeulu_0-1720790990194.png

    I just took out the part that could cause the formatting issue and the issue persists. Any idea why the new error is?

    federicoeulu_2-1720792235657.png

     

    It seems it doesn't work for nulls the empty one. The length would be strange, to be honest.

  • Expiscornovus Profile Picture
    31,652 Most Valuable Professional on 12 Jul 2024 at 13:14:58
    Re: The template function 'IfError' is not defined or not valid.'.

    Hi @federico-eu-lu,

     

    You could for example use an empty or a coalesce function and combine it with an if function. Even a length function should be possible. 

  • federico-eu-lu Profile Picture
    18 on 12 Jul 2024 at 13:05:34
    Re: The template function 'IfError' is not defined or not valid.'.

    Any suggestion on how can I do a try-catch then? Or How can I validate if it's null? I have tried so far:

    • Add it in a scope fails.
    • Move the item to a variable since it can be null or an integer, so, I store it on an object, but it fails to cast it later.
    • Try to validate if it's null and then try to cast it fails.
    • Try to use the IfError fails.

    So, I cannot find any efficient way to make it work. I need just something simple, if the formula fails because it can return a null from the previous operation, it should be able to skip or use the previously stored value. Thanks.

  • Expiscornovus Profile Picture
    31,652 Most Valuable Professional on 12 Jul 2024 at 12:51:57
    Re: The template function 'IfError' is not defined or not valid.'.

    Hi @federico-eu-lu,


    IfError is an PowerFx function. Power Automate cloud flows use a different expression language. That expression language doesn't have an IfError function.

     

    You can find the list of functions over here:

    https://aka.ms/logicexpressions

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,765 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard
Loading started