web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : ahN3miCMoowE1b/0bznAjo
Power Automate - Building Flows
Answered

Expressions works in Condition, not as trigger

Like (0) ShareShare
ReportReport
Posted on 7 Jul 2022 06:55:51 by 22

Hi All,

I'm trying to define a trigger condition, to make the flow run only when the filename contains the string "Uren". The expression I wrote works as a Condition Action, but returns and error when set as trigger condition. If I understand the error correctly, it's trying to read the filename before it's present in the flow, returning a null. How can I fix this?

 

Expressions:  contains( base64ToString(triggerOutputs()?['headers/x-ms-file-name-encoded']),'Uren')

 

Error: InvalidTemplate. Unable to process template language expressions for trigger 'When_a_file_is_created_or_modified_in_a_folder' at line '1' and column '16216': 'The template language function 'base64ToString' expects its parameter to be a string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#base64ToString for usage details.'.

 

The flow:

flow with error.jpg

I have the same question (0)
  • Stefanovic83 Profile Picture
    22 on 22 Jul 2022 at 10:05:57
    Re: Expressions works in Condition, not as trigger

    So is the logic then like this?

     

    When "Uren.xlsx is modified, the condition trigger returns 'Uren'. 

    When something else is modified, the conditrion trigger returns null

  • v-bofeng-msft Profile Picture
    on 22 Jul 2022 at 01:49:14
    Re: Expressions works in Condition, not as trigger

    Hi @Stefanovic83 ,

     

    Cause null value causes an error (base64ToString cannot handle null values), So I add conditional statements to circumvent triggerOutputs()? ['headers/x-ms-file-name-encoded']) If it is empty, it will be no error.

     

    Best Regards,

    Bof

  • Stefanovic83 Profile Picture
    22 on 21 Jul 2022 at 18:12:39
    Re: Expressions works in Condition, not as trigger

    Yeah that works @Shuvam-rpa . I just don't understand yet why. Could you explain? 

     

    The only difference is you adding that first part of the statement:

     

    @if(empty(triggerOutputs()?['headers/x-ms-file-name-encoded']),false,contains( base64ToString(triggerOutputs()?['headers/x-ms-file-name-encoded']),'Uren'))

  • Verified answer
    v-bofeng-msft Profile Picture
    on 12 Jul 2022 at 06:32:22
    Re: Expressions works in Condition, not as trigger

    Hi @Stefanovic83 ,

     

    Please try:

     

    @if(empty(triggerOutputs()?['headers/x-ms-file-name-encoded']),false,contains( base64ToString(triggerOutputs()?['headers/x-ms-file-name-encoded']),'Uren'))

     

    Best Regards,

    Bof

  • Stefanovic83 Profile Picture
    22 on 07 Jul 2022 at 15:38:52
    Re: Expressions works in Condition, not as trigger

    Thanks @Shuvam-rpa but my question was for the expression for the trigger condition.

    I got already the flow working using an action Condition. 🙂 

     

  • Shuvam-rpa Profile Picture
    891 Super User 2024 Season 1 on 07 Jul 2022 at 07:38:59
    Re: Expressions works in Condition, not as trigger

    @Stefanovic83 kindly use below expression

    contains(triggerOutputs()?['headers']?['x-ms-file-name'],'Uren')
     
    please check below screenshot for reference
     
    Shuvamrpa_0-1657179491165.pngShuvamrpa_1-1657179495765.png

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete